gprof: Call Graph
1
1 5.2 The Call Graph
1 ==================
1
1 The "call graph" shows how much time was spent in each function and its
1 children. From this information, you can find functions that, while
1 they themselves may not have used much time, called other functions that
1 did use unusual amounts of time.
1
1 Here is a sample call from a small program. This call came from the
1 same 'gprof' run as the flat profile example in the previous section.
1
1 granularity: each sample hit covers 2 byte(s) for 20.00% of 0.05 seconds
1
1 index % time self children called name
1 <spontaneous>
1 [1] 100.0 0.00 0.05 start [1]
1 0.00 0.05 1/1 main [2]
1 0.00 0.00 1/2 on_exit [28]
1 0.00 0.00 1/1 exit [59]
1 -----------------------------------------------
1 0.00 0.05 1/1 start [1]
1 [2] 100.0 0.00 0.05 1 main [2]
1 0.00 0.05 1/1 report [3]
1 -----------------------------------------------
1 0.00 0.05 1/1 main [2]
1 [3] 100.0 0.00 0.05 1 report [3]
1 0.00 0.03 8/8 timelocal [6]
1 0.00 0.01 1/1 print [9]
1 0.00 0.01 9/9 fgets [12]
1 0.00 0.00 12/34 strncmp <cycle 1> [40]
1 0.00 0.00 8/8 lookup [20]
1 0.00 0.00 1/1 fopen [21]
1 0.00 0.00 8/8 chewtime [24]
1 0.00 0.00 8/16 skipspace [44]
1 -----------------------------------------------
1 [4] 59.8 0.01 0.02 8+472 <cycle 2 as a whole> [4]
1 0.01 0.02 244+260 offtime <cycle 2> [7]
1 0.00 0.00 236+1 tzset <cycle 2> [26]
1 -----------------------------------------------
1
1 The lines full of dashes divide this table into "entries", one for
1 each function. Each entry has one or more lines.
1
1 In each entry, the primary line is the one that starts with an index
1 number in square brackets. The end of this line says which function the
1 entry is for. The preceding lines in the entry describe the callers of
1 this function and the following lines describe its subroutines (also
1 called "children" when we speak of the call graph).
1
1 The entries are sorted by time spent in the function and its
1 subroutines.
1
11 The internal profiling function 'mcount' (⇒The Flat Profile
Flat Profile.) is never mentioned in the call graph.
1
Menu