I have a model code on which kcachegrind / callgrind reports strange results. This is a kind of dispatch function. The dispatcher is called from 4 places; each call says which actual do_J function to run (so first2 will only call do_1 and do_2 , etc.)
Source (this is the actual code model)
Compiled with gcc -O0 ; Callgrinded with valgrind --tool=callgrind ; kcachegrinded with kcachegrind and qcachegrind-0.7 .
Here is the complete application code. All the paths to do_J go through the dispatcher, and thatβs good (do_1 just hides too fast, but it is really here, itβs just left to do do_2)

Focus on do_1 and see who called it (this image is incorrect):

And this is very strange, I think, only first2 and outer2 called do_1 , but not all.
Is this a limitation of callgrind / kcachegrind? How can I get an accurate callgraph with weights (proportional to the runtime of each function, with and without its children)?
osgx source share