为了我的研究,我想介绍一些在不同限制下的程序。我使用perf工具来测量一些计数器。这种分析将持续很长一段时间(几个小时),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 MBs每秒。在24小时内,将达到165 GBs。当我使用perf报告工具时,我看到它也保留了我不需要的函数调用。如何使perf记录工作更加轻量级,并且只记录我需要的数据?随着时间的推移,我只需要对以下数据进行分析,就可以看到随着对系统所做的一些更改,它们是如何变化的。考虑到它记录了大量的数据,我将在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 发布于 2016-01-24 23:48:56
简单的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 elapsedhttps://stackoverflow.com/questions/34981955
复制相似问题