如何在每个样本中从分析器中获取完整的堆栈转储以用于火焰图? [英] How to get complete stack dump from profiler in every sample for use in flame graph?

查看:22
本文介绍了如何在每个样本中从分析器中获取完整的堆栈转储以用于火焰图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常喜欢 火焰图 用于分析,因为它将有助于消除不需要的函数调用.然而,有一个问题,它需要分析器在每次收集样本时进行完整的堆栈转储.这可以通过 DTrace 或 SystemTap 轻松完成,但我需要能够在运行 ubuntu(消除 DTrace)的 ARM 设备上执行此操作.我也想在不重新编译内核的情况下做到这一点(它消除了 SystemTap).

I really like the idea of the Flame Graph for profiling since it will help in eliminating unneeded function calls. There is a catch however in that it requires the profiler to do a complete stack dump each time it collects a sample. This can be accomplished with DTrace or SystemTap quite easily, but I need to be able to do this on an ARM device running ubuntu (which eliminates DTrace). I would also like to do this without recompiling the kernel (which eliminates SystemTap).

是否可以让 Valgrind/Callgrind 或 OProfile(或其他一些可以在 Ubuntu 的 ARM 设备上运行的分析工具)输出类似于:
dtrace -n 'profile-1001/pid == 12345 &&arg1/{ @[ustack()] = count();}

Is it possible to get Valgrind/Callgrind or OProfile (or some other profiling tool that can run on an ARM device in Ubuntu) to output something similar to:
dtrace -n 'profile-1001 /pid == 12345 && arg1/ { @[ustack()] = count(); }

推荐答案

尝试 Linux perf_events(又名perf"命令),它是主线 Linux 内核的一部分,通常通过 linux-tools-common(或类似)包.我经常用它在 Linux 上创建火焰图.

Try Linux perf_events (aka the "perf" command), which is part of the mainline Linux kernel, and usually installed via the linux-tools-common (or similar) package. I often use it to create flame graphs on Linux.

我写了一些使用 perf 创建火焰图的说明:http://www.brendangregg.com/perf.html#FlameGraphs

I wrote up some instructions for creating flame graphs with perf on: http://www.brendangregg.com/perf.html#FlameGraphs

这篇关于如何在每个样本中从分析器中获取完整的堆栈转储以用于火焰图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆