{{lastupdated_at}} by {{lastupdated_by}} h1. How to use valgrind? Valgrid is a very useful tool for finding bottle necks in the execution of code and to identify where actually the type is spent. h2. Running an executable with valgrind
valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes gsrvy (args)
h2. Running an executable on a specific code zone Mark the code zone using some macros

#include 

int main()
{
  foo1();
  CALLGRIND_START_INSTRUMENTATION;
  CALLGRIND_TOGGLE_COLLECT;
  bar1();
  CALLGRIND_TOGGLE_COLLECT;
  CALLGRIND_STOP_INSTRUMENTATION;
  foo2();
  foo3();
}
and run valgrind as follows
valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --collect-atstart=no --instr-atstart=no gsrvy (args)
h2. Advanced usage If the @callgrind.out.*@ file is empty call
callgrind_control -d [hint [PID/Name]]
where hint is an arbitrary string you can optionally specify to later be able to distinguish profile dumps. Check whether instrumentation is turned on using
callgrind_control -b
You can also decide to switch instrumentation on using
callgrind_control -i on
(and switching off again by specifying "off" instead of "on"). h2. Result visualisation Use the @kcachegrind@ GUI to visualise the results.