Previous: , Up: Code Coverage and Profiling   [Contents][Index]

6.2.2 Profiling an Ada Program with gprof

This section is not meant to be an exhaustive documentation of gprof. Full documentation for it can be found in the GNU Profiler User’s Guide documentation that is part of this GNAT distribution.

Profiling a program helps determine the parts of a program that are executed most often, and are therefore the most time-consuming.

gprof is the standard GNU profiling tool; it has been enhanced to better handle Ada programs and multitasking. It is currently supported on the following platforms

In order to profile a program using gprof, several steps are needed:

  1. Instrument the code, which requires a full recompilation of the project with the proper switches.
  2. Execute the program under the analysis conditions, i.e. with the desired input.
  3. Analyze the results using the gprof tool.

The following sections detail the different steps, and indicate how to interpret the results.