Callgrind
lastmod 2026-11-10created 2017-07-162 edits
Callgrind is a profiling tool included in Valgrind. It runs a program on a virtual CPU while recording function call relationships (the call graph) and the number of instructions each function executed, and can optionally also measure cache simulation and branch mispredictions. Because it counts instructions rather than real time, results are reproducible and well suited to cost analysis per call chain. Result files are examined with the callgrind_annotate command or the GUI tool KCachegrind. Since execution slows down considerably, it is suited to analyzing short sections.
Callgrind: a call-graph generating cache and branch prediction profiler.