Callgrind Format Specification
Remark: For assembler annotation to work, instruction addresses have to be corrected to correspond to addresses
found in the original binary. I.e. for relocatable shared objects, often a load offset has to be subtracted.
3.1.7. Miscellaneous
3.1.7.1. Cost Summary Information
For the visualization to be able to show cost percentage, a sum of the cost of the full run has to be known. Usually, it
is assumed that this is the sum of all cost lines in a file. But sometimes, this is not correct. Thus, you can specify a
"summary:" line in the header giving the full cost for the profile run. This has another effect: a import filter can show
a progress bar while loading a large data file if he knows to cost sum in advance.
3.1.7.2. Long Names for Event Types and inherited Types
Event types for cost lines are specified in the "events:" line with an abbreviated name. For visualization, it makes sense
to be able to specify some longer, more descriptive name. For an event type "Ir" which means "Instruction Fetches",
this can be specified the header line
event: Ir : Instruction Fetches
events: Ir Dr
In this example, "Dr" itself has no long name associated. The order of "event:" lines and the "events:" line is of no
importance. Additionally, inherited event types can be introduced for which no raw data is available, but which are
calculated from given types. Suppose the last example, you could add
event: Sum = Ir + Dr
to specify an additional event type "Sum", which is calculated by adding costs for "Ir and "Dr".
3.2. Reference
3.2.1. Grammar
ProfileDataFile := FormatVersion? Creator? PartData*
FormatVersion := "version:" Space* Number "\n"
Creator := "creator:" NoNewLineChar* "\n"
PartData := (HeaderLine "\n")+ (BodyLine "\n")+
HeaderLine := (empty line)
| (’#’ NoNewLineChar*)
| PartDetail
| Description
| EventSpecification
| CostLineDef
13