您想要做的是用户空间探测。Perf只能做一部分。尝试sudo perf top -p [pid]然后观察记分牌。它将显示按 CPU 使用率排序的函数列表。以下是基准测试期间 Redis 的快照:

如果你想获得用户层功能的更多信息,例如 IO 使用情况、延迟、内存使用情况,我强烈建议你使用 Systemtap。它既是脚本语言,也是在基于 Linux 内核的操作系统上分析程序的工具。这是一个关于它的教程:
http://qqibrow.github.io/performance-profiling-with-systemtap/
而且您不需要成为 systemtap 脚本编写专家,网上有很多好的脚本适合您。例如,有一个关于使用它来找出特定功能的延迟的示例。
https://github.com/openresty/stapxx#func-latency-distr
小智 0
perf 的文档位于https://perf.wiki.kernel.org/index.php/Main_Page,教程位于https://perf.wiki.kernel.org/index.php/Tutorial
perf 报告按“命令”进行细分,请参阅https://perf.wiki.kernel.org/index.php/Tutorial#Sample_analysis_with_perf_report。perf annotate 提供了一种选择要报告的命令的方法,请参阅https://perf.wiki.kernel.org/index.php/Tutorial#Options_controlling_output_2中的“使用 perf annotate 进行源级别分析” 。
| 归档时间: |
|
| 查看次数: |
5288 次 |
| 最近记录: |