GNU gprof: Primary

Next: Callers, Up: Call Graph [Contents]

#### 5.2.1 The Primary Line

The primary line in a call graph entry is the line that describes the function which the entry is about and gives the overall statistics for this function.

For reference, we repeat the primary line from the entry for function `report` in our main example, together with the heading line that shows the names of the fields:

    index  % time    self  children called     name
    …
    [3]    100.0    0.00    0.05       1         report [3]

Here is what the fields in the primary line mean:

`index`

  Entries are numbered with consecutive integers. Each function therefore has an index number, which appears at the beginning of its primary line.

  Each cross-reference to a function, as a caller or subroutine of another, gives its index number as well as its name. The index number guides you if you wish to look for the entry for that function.

`% time`

  This is the percentage of the total time that was spent in this function, including time spent in subroutines called from this function.

  The time spent in this function is counted again for the callers of this function. Therefore, adding up these percentages is meaningless.

`self`

  This is the total amount of time spent in this function. This should be identical to the number printed in the `seconds` field for this function in the flat profile.

`children`

  This is the total amount of time spent in the subroutine calls made by this function. This should be equal to the sum of all the `self` and `children` entries of the children listed directly below this function.

`called`

  This is the number of times the function was called.

  If the function called itself recursively, there are two numbers, separated by a ‘`+`’. The first number counts non-recursive calls, and the second counts recursive calls.

  In the example above, the function `report` was called once from `main`.

`name`

  This is the name of the current function. The index number is repeated after it.

  If the function is part of a cycle of recursion, the cycle number is printed between the function’s name and the index number (see How Mutually Recursive Functions Are Described). For example, if function `gnurr` is part of cycle number one, and has index number twelve, its primary line would be end like this:

      gnurr <cycle 1> [12]

Next: Callers, Up: Call Graph [Contents]