C++ profiling

  • gprof, gprof2dot --wrap
  • valgrind - build with -g, run valgrind -s a.out (expect 100 times slow down)
  • perf
  • /usr/bin/time --verbose
  • Tracy
  • htop
  • Google Benchmark
  • hotspot
  • Optick -- lightweight profiling for games

Google Test

OK, not stricly a profiler but you do get a duration for each unit test; and it's good practice be testing as you go.


Use -p for prof and -pg for gprof. But it will take longer to run.


echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
perf stat app.o


Slows down the application by up to 20 times.

# Memory leaks
valgrind app.o
valgrind --leak-check=full app.o

# Cache issues
valgrind --tool=cachegrind app.o

# Thread issues
valgrind --tool=helgrind app.o


Graph tools

Compiler options

Reading list

results matching ""

    No results matching ""