Callgrind Format Specification
line 16 in file
file.f
, taking 20 CPU cycles. If a cost line specifies less event counts than given in the "events" line,
the rest is assumed to be zero. I.e. there was no floating point instruction executed relating to line 16.
Note that regular cost lines always give self (also called exclusive) cost of code at a given position. If you specify
multiple cost lines for the same position, these will be summed up. On the other hand, in the example above there is
no specification of how many times function
main
actually was called: profile data only contains sums.
3.1.3. Associations
The most important extension to the original format of Cachegrind is the ability to specify call relationship among
functions. More generally, you specify associations among positions. For this, the second part of the file also can
contain association specifications. These look similar to position specifications, but consist of 2 lines. For calls, the
format looks like
calls=(Call Count) (Destination position)
(Source position) (Inclusive cost of call)
The destination only specifies subpositions like line number. Therefore, to be able to specify a call to another function
in another source file, you have to precede the above lines with a "cfn=" specification for the name of the called
function, and a "cfl=" specification if the function is in another source file. The 2nd line looks like a regular cost line
with the difference that inclusive cost spent inside of the function call has to be specified.
Other associations are for example (conditional) jumps. See the reference below for details.
3.1.4. Extended Example
The following example shows 3 functions,
main
,
func1
, and
func2
. Function
main
calls
func1
once and
func2
3 times.
func1
calls
func2
2 times.
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
10