如何在CentOS上生成Node.js火焰图?

时间:2022-11-25 13:36:10

I'd like to generate a flame graph for my node.js app. Unfortunately, my dev box is OSX (doesn't support utrace helpers, per the linked article) and my production box is CentOS (doesn't even have dtrace).

我想为我的node.js app生成一个火焰图。不幸的是,我的开发盒是OSX(根据链接的文章不支持utrace助手),我的生产盒是CentOS(甚至没有dtrace)。

I've found some indication that something like SystemTap might be a dtrace alternative, but I've been unable to cobble together an effective working way to generate the appropriate stacks.out file to feed into stackvis.

我发现一些迹象表明像SystemTap这样的东西可能是一个替代品,但我一直无法拼凑出一种有效的工作方式来生成适当的stacks.out文件以提供给stackvis。

Does anybody know of a decent tutorial on how to get this up and running? I'd prefer it on CentOS (so I can examine my production app) but OSX would also be sufficient.

有没有人知道一个关于如何启动和运行的体面教程?我更喜欢它在CentOS上(所以我可以检查我的生产应用程序)但OSX也足够了。

2 个解决方案

#1


2  

From the latest google searches, people are unhappy with SystemTap on Centos, but here is an article http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/ that was referenced by someone's FlameGraph github project https://github.com/brendangregg/FlameGraph

从最新的谷歌搜索,人们对Centos上的SystemTap不满意,但这里有一篇文章http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/由某人的FlameGraph github项目https://github.com/brendangregg/FlameGraph

I would say move towards the real solution, of getting dtrace installed rather than relying on the work around.

我会说真正的解决方案是安装dtrace而不是依赖于解决方案。

#2


2  

On Linux, the perf_events profiler can be used to sample stack traces, and has JIT symbol support. For node.js, you need to be running version 0.11.13 or higher, with the v8 option --perf-basic-prof. That option creates a /tmp/perf-PID.map file for symbol translation, which perf uses. Once you have perf profiling stack traces with JavaScript symbols, you can then create flame graphs using stackcollapse-perf.pl (from the FlameGraph repo) on the output of "perf script".

在Linux上,perf_events探查器可用于对堆栈跟踪进行采样,并具有JIT符号支持。对于node.js,您需要运行版本0.11.13或更高版本,使用v8选项--perf-basic-prof。该选项为perf使用的符号转换创建一个/tmp/perf-PID.map文件。一旦使用JavaScript符号对堆栈跟踪进行分析,就可以使用“perf script”输出中的stackcollapse-perf.pl(来自FlameGraph repo)创建火焰图。

I wrote up the full instructions here: http://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html

我在这里写了完整的说明:http://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html

#1


2  

From the latest google searches, people are unhappy with SystemTap on Centos, but here is an article http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/ that was referenced by someone's FlameGraph github project https://github.com/brendangregg/FlameGraph

从最新的谷歌搜索,人们对Centos上的SystemTap不满意,但这里有一篇文章http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/由某人的FlameGraph github项目https://github.com/brendangregg/FlameGraph

I would say move towards the real solution, of getting dtrace installed rather than relying on the work around.

我会说真正的解决方案是安装dtrace而不是依赖于解决方案。

#2


2  

On Linux, the perf_events profiler can be used to sample stack traces, and has JIT symbol support. For node.js, you need to be running version 0.11.13 or higher, with the v8 option --perf-basic-prof. That option creates a /tmp/perf-PID.map file for symbol translation, which perf uses. Once you have perf profiling stack traces with JavaScript symbols, you can then create flame graphs using stackcollapse-perf.pl (from the FlameGraph repo) on the output of "perf script".

在Linux上,perf_events探查器可用于对堆栈跟踪进行采样,并具有JIT符号支持。对于node.js,您需要运行版本0.11.13或更高版本,使用v8选项--perf-basic-prof。该选项为perf使用的符号转换创建一个/tmp/perf-PID.map文件。一旦使用JavaScript符号对堆栈跟踪进行分析,就可以使用“perf script”输出中的stackcollapse-perf.pl(来自FlameGraph repo)创建火焰图。

I wrote up the full instructions here: http://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html

我在这里写了完整的说明:http://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html