Profiling on Linux¶
perf¶
sudo apt-get install linux-tools-common linux-tools-`uname -r`
pip install gprof2dot
The Linux perf command (a.k.a. perf_events) is one of several tools available for performance analysis.
perf record -g <binary>
#perf record
perf script | c++filt | gprof2dot -f perf --strip | dot -Tpng -o output.png
c++filt is necessary at the moment to demangle function names.
memcheck¶
valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes <binary>
cachegrind¶
valgrind --tool=cachegrind <binary>
kcachegrind cachegrind.out.<pid>