gpt4 book ai didi

linux - 可以从 perf.data 文件生成 perf-stat 结果吗?

转载 作者:IT王子 更新时间:2023-10-29 00:56:52 26 4
gpt4 key购买 nike

当我想使用 Linux 工具套件中的 perf-stat 和 perf-report 生成性能报告时 perf ,我跑:

$ perf record -o my.perf.data myCmd
$ perf report -i my.perf.data

和:

$ perf stat myCmd

但这意味着我要第二次运行“myCmd”,这需要几分钟时间。相反,我希望:

$ perf stat -i my.perf.data

但与 perf 套件中的大多数工具不同,我没有看到 perf-stat 的 -i 选项。是否有其他工具,或者有办法让 perf-report 生成与 perf-stat 类似的输出?

最佳答案

我深入研究了 kernel.org 上的源代码,看起来没有办法让 perf stat 来解析 perf.data

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=tools/perf/builtin-stat.c;h=c70d72003557f17f29345b0f219dc5ca9f572d75;hb=refs/heads/linux-2.6.33.y

如果您查看第 245 行,您会看到函数“run_perf_stat”,而第 308-320 行似乎是实际进行记录和整理的内容。

我没有深入研究这个问题来确定是否可以启用您想要的那种功能。

看起来 perf 报告没有很多额外的格式化功能。如果您愿意,可以在此处进一步查看:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=tools/perf/builtin-report.c;h=860f1eeeea7dbf8e43779308eaaffb1dbcf79d10;hb=refs/heads/linux-2.6.33.y

关于linux - 可以从 perf.data 文件生成 perf-stat 结果吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10321073/

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