C++ profiling
- gprof,
gprof2dot --wrap
- valgrind - build with
-g
, runvalgrind -s a.out
(expect 100 times slow down) - perf
/usr/bin/time --verbose
- Tracy
- htop
- Google Benchmark
- hotspot
- Optick -- lightweight profiling for games
- Hotspot
- VTune
- Magic Trace
- vtune-profiler cookbook
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.
gprof
Use -p
for prof
and -pg
for gprof
. But it will take longer to run.
perf
echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
perf stat app.o
valgrind
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
Helpers
Graph tools
Compiler options
- https://docs.microsoft.com/en-us/visualstudio/profiling/beginners-guide-to-performance-profiling?view=vs-2019
- https://docs.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code?view=msvc-160
- https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-debug-optimized-code?view=vs-2019
- https://www.youtube.com/watch?v=yRKRqzekLU4
- https://www.youtube.com/watch?v=THE14sSDT6A&feature=youtu.be
- https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html