Heavyweight Profiling with KCachegrind
More Information
Install Required Packages
The kdesdk package has a lot of dependencies:
sudo yum install kdesdk valgrind graphviz
Basic Usage
Start the program with cachegrind enabled:
valgrind \
--tool=callgrind \
--dump-instr=yes \
--trace-jump=yes \
--simulate-cache=yes \
<myprog-and-args>
When the program terminates a data file will be written. It's OK to ^C the program to terminate it.
Run the kcachegrind analyzer on the resulting data file:
kcachegrind callgrind.out.<pid>
Deferring heavyweight profiling to interesting execution sequence
Start the program, cachegrind deferred:
valgrind \
--tool=callgrind \
--dump-instr=yes \
--trace-jump=yes \
--simulate-cache=yes \
--instr-atstart=no \
<myprog-and-args>
When the program gets to the interesting spot:
callgrind_control -i on
After the program gets past the interesting spot:
callgrind_control -i off