(First of all, even though this is a bug report, I want
to express my appreciation for your beautiful piece of
work!)
This is with valgrind-2.20, callgrind-0.9.9,
KCachegrind 0.4.5.
Say there are 2 functions: 'foo' and 'bar'.
'foo' code contains two calls to 'bar': on line 1 and
line 10. In the profiled program, 'bar' is called from
'foo' 200 times. All of the calls are originating from
line 1.
But... when I look at the annotated source code for
'foo' in KCachegrind, I see the 200 calls to 'bar'
appearing in line 10 (in fact, line 1 isn't even
displayed).
I tried to make sense of the callgrind output file
myself and figure out if this is a data collection
problem or a GUI problem but couldn't reach a
conclusion I'm certain in (I'm not entirely sure how to
interpret relative subpositions in 'calls=' lines -
what are they relating to?).
Following is the data collected by callgrind from the
actual program. In this data:
'foo' is function (8286)
'bar' is 'param_spec_ht_lookup'
The calls to 'bar' from 'foo' are in lines 776 & 747 of
'foo', but only the call from line 747 is actually ever
exeucted. In KCachegrind, the call cost is displayed
for line 776 only (so it looks like all of the calls
originated from there - although the opposite is the
truth).
fn=(8286)
730 74598 0 49732 394 0 0 50
+4 12433 12433
-4 24866
+4 62165 12433
+6 49732 24866 0 0 29 0 0 6
+2 68357 26414 4644 415 271 2 0 62
* 1923 1923 0 6 9 0 3 1
cob=(3)
cfi=(5)
cfn=(2518)
calls=1923 0
* 84291 11229 1548 1551 641 0 645 322
* 3096
+3 24866 0 0 771 0 0 2
+42 74598 62165 0 1421 0 0 115
-11 37299 24866 24866 1234 0 28 45 0 15
cfn=(8288) param_spec_ht_lookup
calls=12979 -95
* 28468656 8961744 4113325 24754 26789 1505 619 7076 526
* 12433
+1 62165 24866
+2 24866 0 0 799 0 0 11
-32 49732 37299 37299 497 0 130 0 0 24
If you need any more details or if there's something
I've missed, please write me at: chastamar_at_yahoo.com
Cheers,
Chas
The entire callgrind output file. I hope what I wrote is enough and you won't need it :-)