gpt4 book ai didi

Linux Perf Counting Instructions, Cycles, Cache misses more lightweight over long time

转载 作者:太空宇宙 更新时间:2023-11-04 09:27:16 24 4
gpt4 key购买 nike

我想在不同的研究限制下介绍一些程序。我使用 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 MB。 24 小时后,将达到 165 GB。当我使用 perf 报告工具时,我看到它还保留了我不需要的函数调用。如何让 perf-record 工作起来更轻量级,只记录我需要的数据?我只需要随着时间的推移分析以下数据,看看它们如何随着我对系统所做的一些更改而变化。考虑到它记录了很多数据,我将在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

关于Linux Perf Counting Instructions, Cycles, Cache misses more lightweight over long time,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34981955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com