Use ValgrindValgrind, callgrindCallgrind and kcachegrindKCacheGrind:
valgrind --tool=callgrind ./(Your binary)
generates callgrind.out.xfile callgrind.out.x. Read it using kcachegrindKCacheGrind.
Use gprof (add -pg-pg
):
cc -o myprog myprog.c utils.c -g -pg
(not so good for multi-threads, function pointers)
Use google-perftools:
Uses time sampling, I/O and CPU bottlenecks are revealed.
Intel VTuneVTune is the best (free for educational purposes).
Others: AMD CodeanalystCodeAnalyst (since replaced with AMD CodeXLCodeXL), OProfileOProfile, 'perf'and 'perf' tools (apt-get install linux-toolsapt-get install linux-tools
)