[英]Linux Perf Counting Instructions, Cycles, Cache misses more lightweight over a long time
我想为我的研究配置一些受不同限制的程序。 我使用性能工具测量一些计数器。 该分析将进行很长时间(数小时),并且perf工具会生成过多不需要的数据。 例如:
$ perf record -e cycles,instructions,cache-misses,cpu-clock,context-switches,cpu-migrations ./stress-ng --cpu 4 --cpu-ops 10000
stress-ng: info: [6642] defaulting to a 86400 second run per stressor
stress-ng: info: [6642] dispatching hogs: 4 cpu
stress-ng: info: [6642] successful run completed in 15.57s
[ perf record: Woken up 117 times to write data ]
[ perf record: Captured and wrote 29.971 MB perf.data (~1309444 samples) ]
大约每秒1.92 MB。 在24小时内,将达到165 GB。 当我使用性能报告工具时,我看到它还保留了我不需要的函数调用。 如何使性能记录工作更轻巧,并且仅记录我需要的数据? 我只需要随着时间的推移分析以下数据,看看它们如何随着我对系统所做的更改而发生变化。 考虑到它记录了大量数据,我将在24台核心计算机中使用它,因此数据非常大。 到目前为止,最好的选择是定期记录并分析perf.data以获取所需的整数并将其删除,但是我认为应该有更好的选择,因为我可能会错过该窗口中的某些性能分析数据。
Performance counter stats for './stress-ng --cpu 4 --cpu-ops 10000':
128.290.294.651 cycles
201.217.788.817 instructions # 1,57 insns per cycle
3.048.096 cache-misses
40340,258757 cpu-clock (msec)
123 context-switches
25 cpu-migrations
10,205760993 seconds time elapsed
简单的性能perf stat
输出对您有好处吗? 例如
$ perf stat -e cycles,instructions,cache-misses,cpu-clock,context-switches,cpu-migrations date
Sun Jan 24 18:46:10 EST 2016
Performance counter stats for 'date':
1,269,265 cycles
660,875 instructions # 0.52 insns per cycle
2,265 cache-misses
0.644391 cpu-clock (msec)
2 context-switches
1 cpu-migrations
0.001031207 seconds time elapsed
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.