- Home
- Profiling Software
- GNU gprof
GNU gprof
What it is
GNU gprof is a free, open-source command-line profiler for Linux and self-hosted development. It analyzes profiling data to show which parts of a program consume the most execution time. Reports can include a flat profile, call graph, and annotated source output. Programs must be compiled and linked with profiling enabled, typically with the compiler option -pg. A profiled program writes data to gmon.out when it exits normally, and gprof can combine statistics from multiple profile files. Measurements exclude time when the program is not running, including delays caused by I/O or swapping. Profiling adds function-call overhead that can create artificial hot spots. The -l line-profiling feature works only with programs built by older GCC versions; newer GCC versions use gcov for line-by-line information. The Binutils manual describes gprofng as a more modern profiler that reads gmon files and offers more functionality.
For and against
For
- Flat profile and call graph reports
- Annotated source output
- Combines multiple profile files
- Free open-source Binutils tool
- Supports C and C++
Against
- Requires compiling with profiling enabled
- I/O and swapping delays are excluded
- Instrumentation can create artificial hot spots
- Line profiling needs older GCC
The verdict
GNU gprof provides established command-line profiling reports for instrumented C and C++ programs. Its timing boundaries and overhead matter when interpreting results, and newer line profiling uses gcov instead.
Who it suits
GNU gprof suits Linux developers profiling C or C++ programs from the command line. It is intended for desktop or self-hosted workflows where compilation with profiling support is possible.
Plans and prices
GNU gprof
GNU Binutils command-line profiler
Read 4 Oct 2026 · sourceware.org
On the record
- Alternative in suite
- The manual describes gprofng as a more modern profiler in Binutils that can read gmon files and provides more functionality.sourceware.org · read 4 Oct 2026
- Build requirement
- Programs must be compiled and linked with profiling enabled, typically using the compiler option -pg.sourceware.org · read 4 Oct 2026
- Combine profiles
- gprof can sum statistics from multiple profile data files.sourceware.org · read 4 Oct 2026
- Data collection
- The profiled program writes its data to gmon.out when it exits normally.sourceware.org · read 4 Oct 2026
- Download
- GNU Binutils releases are available from ftp.gnu.org and sourceware.org.sourceware.org · read 4 Oct 2026
- Instrumentation overhead
- Profiling adds overhead to function calls, which the manual says can create artificial hot spots.sourceware.org · read 4 Oct 2026
- License
- The gprof manual is distributed under the GNU Free Documentation License version 1.3.sourceware.org · read 4 Oct 2026
- Line profiling
- The -l line profiling feature works only with programs compiled by older GCC versions; newer GCC versions use gcov for line-by-line information.sourceware.org · read 4 Oct 2026
- Outputs
- It can print a flat profile and call graph, and provide annotated source output.sourceware.org · read 4 Oct 2026
- Purpose
- GNU gprof analyzes profiling data to show which parts of a program take the most execution time.sourceware.org · read 4 Oct 2026
- Sampling limits
- Its time measurements do not account for time when a program is not running, such as time limited by I/O or swapping.sourceware.org · read 4 Oct 2026
- Support channels
- The project lists Bugzilla for bug reports and mailing lists for bug reporting and discussion.sourceware.org · read 4 Oct 2026