Changes between Initial Version and Version 1 of CallgrindFormat

Show
Ignore:
Timestamp:
07/26/09 07:13:19 (13 years ago)
Author:
cotto
Comment:

initial version

Legend:

Unmodified
Added
Removed
Modified
  • CallgrindFormat

    v1 v1  
     1= Introduction = 
     2 
     3Callgrind's output format is very general because it's targeted by a number of different tools.  This page describes Callgrind's output format as it pertains to PIR-level profiling for Parrot. 
     4 
     5= Terms = 
     6 
     7 * '''Process under test''' - This is the process of the program being profiled, i.e. a PIR program of some sort. 
     8 * '''Profile''' - This refers to the output file containing profiling information for the process under test. 
     9 
     10= Format Description = 
     11 
     12The format consists of a header and a body.  The header consists of several key value pairs which describe the purpose of the profile.  KCachegrind ignores lines it doesn't know about.  In the example below, this feature is used to add comments to an example profile.  See the bottom of this page for information about how this example was generated. 
     13 
     14== Example == 
     15 
     16=== Example C Code === 
     17The following C code was used to generate a (nearly) trivial profile: 
     18{{{ 
     19#!c 
     20#include <stdio.h> 
     21#include <valgrind/callgrind.h> 
     22 
     23void func1(); 
     24void func2(); 
     25void func3(); 
     26 
     27int main() { 
     28    CALLGRIND_START_INSTRUMENTATION; 
     29    func1(); 
     30    func2(); 
     31    func3(); 
     32    CALLGRIND_STOP_INSTRUMENTATION; 
     33} 
     34 
     35void func1() { 
     36    int i; 
     37    for (i = 0; i < 1000000; i++); 
     38} 
     39 
     40void func2() { 
     41    int i; 
     42    for (i = 0; i < 1000000; i++); 
     43    func1(); 
     44} 
     45 
     46void func3() { 
     47    int i; 
     48    for (i = 0; i < 1000000; i++); 
     49    func2(); 
     50    func1(); 
     51} 
     52}}} 
     53 
     54The program was compiled and profiled as follows: 
     55{{{ 
     56gcc callgrind_test.c -g -o callgrind_test 
     57valgrind --tool=callgrind --compress-strings=no --compress-pos=no --instr-atstart=no ./callgrind_test 
     58}}} 
     59 
     60=== Annotated Header from the Profile of above C Code === 
     61 
     62The above valgrind invocation produced a profile in callgrind.out.PID, where PID is the process ID of the process under test.  Below is the header of the profile, annotated with a description of the purpose of each line. 
     63 
     64{{{ 
     65#!sh 
     66# version of the Callgrind format 
     67version: 1 
     68 
     69# what created this profile, informational only 
     70creator: 3.4.1-Debian 
     71 
     72# PID of the process under test 
     73pid: 5751 
     74 
     75# the full CLI invocation that started the process under test 
     76cmd:  ./callgrind_test 
     77 
     78# used when multiple dumps are produced, starts from 1 and increments 
     79part: 1 
     80 
     81# parameters used for the cache simulator; not relevant for function profiling 
     82desc: I1 cache: 
     83desc: D1 cache: 
     84desc: L2 cache: 
     85 
     86# not really sure 
     87desc: Timerange: Basic block 0 - 7000029 
     88 
     89# Why did the process under test stop?  (informational only) 
     90desc: Trigger: Program termination 
     91 
     92# (optional) what do positions mean? 
     93# "line" - (default) positions are line numbers in a file 
     94# "instr" - positions are offsets in a binary representing instructions 
     95positions: line 
     96 
     97# (required) event types logged by this file 
     98# "Ir" - instruction read access 
     99# "I1mr" - instruction L1 read cache miss 
     100# "I2mr" - instruction L2 read cache miss 
     101events: Ir 
     102 
     103# (recommended) the total number of events covered by this profile 
     104# This is intended to allow postprocessing tools to know the total cost in advance. 
     105# "totals" appears at the end of the file and has the same value. 
     106summary: 21000073 
     107}}} 
     108 
     109=== Annotated Body from the Profile of above C Code === 
     110 
     111This space for rent.