Similarly you can use
valgrind --tool=callgrind --collect-atstart=no --toggle-collect=<function>
Other viewing options:
--instr-atstart
To get information about the level of training:
--collect-jumps=yes --dump-instr=yes
Alternatively, you can "remotely control" it on the fly: callgrind_control or annotate the source code (IIRC also with branch forecast statistics): callgrind_annotate .
Great tool kcachegrind is a great visual / navigation tool . I can hardly recommend it enough:

source share