Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Callgrind Profile Format inclusive/self cost

I'm trying to understand the Callgrind Profile Format. I found the online description

I thought I understood it fairly well until I encountered the 'Extended Example':

events: Instructions

fl=file1.c 
fn=main
16 20 
cfn=func1 
calls=1 50 
16 400 
cfl=file2.c 
cfn=func2 
calls=3 20 
16 400

fn=func1 
51 100 
cfl=file2.c 
cfn=func2 
calls=2 20 
51 300

fl=file2.c 
fn=func2 
20 700

The description reads: One can see that in "main" only code from line 16 is executed where also the other functions are called. Inclusive cost of "main" is 420, which is the sum of self cost 20 and costs spent in the calls.

How can the inclusive cost of 'main' be 420, when the self cost of only func2 is already 700?

like image 687
Arnout Engelen Avatar asked Dec 04 '25 17:12

Arnout Engelen


1 Answers

OK, the description is wrong: when i paste this example and open it in kcachegrind, indeed it shows a total inclusive cost of 820. That makes sense. Sorry for the noise.

like image 151
Arnout Engelen Avatar answered Dec 06 '25 10:12

Arnout Engelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!