How to get a full stack reset from the profiler in each example for use in flame graphics?

I really like the idea of Flame Graph for profiling, as this will help eliminate unnecessary function calls. However, there is a trick in that it requires the profiler to perform a full stack reset each time it collects a sample. This can be done using DTrace or SystemTap quite easily, but I need to do this on an ARM device running on ubuntu (which excludes DTrace). I would also like to do this without recompiling the kernel (which excludes SystemTap).

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: dtrace -n 'profile-1001 /pid == 12345 && arg1/ { @[ustack()] = count(); } dtrace -n 'profile-1001 /pid == 12345 && arg1/ { @[ustack()] = count(); }

+3
source share
2 answers

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

I wrote some instructions for creating fiery graphs with performance: http://www.brendangregg.com/perf.html#FlameGraphs

+6
source

pstack was proposed by Mike Dunlaway, who unfortunately segfaults after I applied the ARM patch and ran it on an ARM device. As long as I don't have time to look at this, I have found the following solution:

http://www.commandlinefu.com/commands/view/4039/print-stack-trace-of-a-core-file-without-needing-to-enter-gdb-interactively

It uses gdb with the following command: gdb --q --n --ex bt --batch --pid PID

A bit slow but working.

+1
source

Source: https://habr.com/ru/post/1208035/


All Articles