Profiling tools¶

2024

The profiler analyzes the execution of a program to identify performance bottlenecks, memory leaks, and other inefficiencies. Profilers can be used to collect a variety of data about a program’s execution, including CPU usage, memory usage, function call counts, and instruction counts.

strace¶

Trace all system calls in a program.

ltrace¶

ltrace is a dynamic debugging tool that tracks library calls made by a program.

callgrind¶

valgrind --tool=callgrind [callgrind options] your-program [program options]

cf. Callgrind: a call-graph generating cache and branch prediction profiler

perf¶

cf. perf: Linux profiling with performance counters

Tracing function calls¶

cf. Tracing with GCC

addr2line can map an address to the corresponding source file.

gprof¶

Compile your program with the option -pg (either with the g++ or the gcc compiler). Run your program, which produces an extra file called gmon.out. Then run the following command to produce profiling information.

gprof a.out

where a.out is the name of your executable that you ran to profile

sprof¶

gperftools¶

heaptrack¶

  • github

  • cf. https://linux.developpez.com/tutoriels/apprendre-heaptrack/