Brendan D. Gregg(DTrace书的作者)有趣的变种:
“Off-CPU” profiling(和
Off-CPU Flame Graph;
slides 2013, p112-137)看到,线程或应用程序被阻止(没有被CPU执行,但是等待I / O,pagefault处理程序,或由于CPU资源不足而被排除):
This time reveals which code-paths are blocked and waiting while off-CPU, and for how long exactly. This differs from traditional profiling which often samples the activity of threads at a given interval, and (usually) only examine threads if they are executing work on-CPU.
Gregg给出的示例使用dtrace,这在Linux操作系统中通常不可用.但是,有一些类似的工具(ktap,systemtap,perf)和perf,因为我认为最广泛的安装基础.通常perf生成的On-CPU配置文件(哪些功能在CPU上执行得更频繁).
>如何将Gregg的Off-CPU示例转换为Linux中的perf性能分析工具?
PS:slides from LISA13, p124中有与Off-CPU火焰记录器的systemtap变体的链接:“Yichun Zhang创建了这些,并在Linux上使用SystemTap收集数据,参见:http://agentzh.org/misc/slides/off-cpu-flame-graphs.pdf”“(CloudFlare Beer Meeting on 23 2013年8月)