Profiling an Ada Program with gprof (GNAT User’s Guide for Native Platforms)

#### 6.2.1 Profiling an Ada Program with gprof ¶

This section is not meant to be an exhaustive documentation of `gprof`. You can find full documentation for it 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’s currently supported on the following platforms

- Linux x86/x86_64
- Windows x86/x86_64 (without PIE support)

In order to profile a program using `gprof`, you need to perform the following steps:

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.