Freedom251 › Profiling Software
GNU gprof

What GNU gprof is
GNU gprof is a free, open-source command-line profiler for Linux and self-hosted use. It analyzes profiling data to show which parts of a program take the most execution time, and supports C and C++ programs. Reports can include a flat profile, a call graph, and annotated source output. Programs must be compiled and linked with profiling enabled, typically using the compiler option `-pg`. When a profiled program exits normally, it writes its data to `gmon.out`; gprof can also combine statistics from multiple profile data files.
The timing has limits: it does not count time when a program is not running, such as time constrained by I/O or swapping. Profiling adds function-call overhead, which can create artificial hot spots. The `-l` line-profiling feature works only with programs built using older GCC versions; newer GCC versions use gcov for line-by-line information. The Binutils manual describes gprofng as a more modern profiler in the suite that can read gmon files and provides more functionality. GNU Binutils releases are available from ftp.gnu.org and sourceware.org. Bug reports and discussion are handled through Bugzilla and mailing lists. The gprof manual is distributed under the GNU Free Documentation License version 1.3.
Who it suits
GNU gprof suits C and C++ developers who can compile and link their programs with profiling enabled and want execution-time reports. It is intended for Linux and self-hosted use, with a desktop deployment model.
What it does well
- Reports can include a flat profile, call graph, and annotated source.
- Combines statistics from multiple profile data files.
- Free and open source under the GNU Binutils project.
- Supports profiling for C and C++ programs.
What to know first
- Profiling requires compiling and linking with `-pg` or equivalent.
- Timing excludes periods when the program is not running.
- Profiling overhead can create artificial hot spots.
- Line profiling works only with older GCC builds.
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| GNU gprof | GNU Binutils command-line profiler | Free |
As sourceware.org lists them, read 4 Oct 2026. The maker's own page has the final word.
Getting started
- Get a GNU Binutils release from ftp.gnu.org or sourceware.org.
- Compile and link the program with profiling enabled, typically using `-pg`.
- Run the profiled program and let it exit normally to write `gmon.out`.
- Use gprof to inspect the profiling data.
Verdict
Choose GNU gprof when you need flat profiles, call graphs, or annotated source for a program built with profiling enabled. Its timing boundaries and function-call overhead matter when interpreting results. For line-by-line profiling on newer GCC versions, the manual points to gcov; it also describes gprofng as a more modern Binutils profiler with more functionality.
Questions
How much does GNU gprof cost?
It is free, with a listed price of $0.
Is GNU gprof open source?
Yes. It is listed as open source, and its manual is distributed under the GNU Free Documentation License version 1.3.
Which platforms and languages does it support?
It is listed for Linux and self-hosted use, with support for C and C++.
What reports can gprof produce?
It can print a flat profile and call graph, and provide annotated source output.
How does profiling data get collected?
Programs must be compiled and linked with profiling enabled, typically with `-pg`. A program writes data to `gmon.out` when it exits normally.
What are the main profiling limitations?
Timing excludes periods when the program is not running, including time limited by I/O or swapping. Profiling overhead can create artificial hot spots, and `-l` line profiling works only with older GCC versions.
Facts from GNU gprof's own pages
- 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, 4 Oct 2026
- Build requirement
- Programs must be compiled and linked with profiling enabled, typically using the compiler option -pg. · sourceware.org, 4 Oct 2026
- Combine profiles
- gprof can sum statistics from multiple profile data files. · sourceware.org, 4 Oct 2026
- Data collection
- The profiled program writes its data to gmon.out when it exits normally. · sourceware.org, 4 Oct 2026
- Download
- GNU Binutils releases are available from ftp.gnu.org and sourceware.org. · sourceware.org, 4 Oct 2026
- Instrumentation overhead
- Profiling adds overhead to function calls, which the manual says can create artificial hot spots. · sourceware.org, 4 Oct 2026
- License
- The gprof manual is distributed under the GNU Free Documentation License version 1.3. · sourceware.org, 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, 4 Oct 2026
- Outputs
- It can print a flat profile and call graph, and provide annotated source output. · sourceware.org, 4 Oct 2026
- Platforms
- The Binutils project says its tools have been ported to most major Unix variants and Wintel systems. · sourceware.org, 4 Oct 2026
- Purpose
- GNU gprof analyzes profiling data to show which parts of a program take the most execution time. · sourceware.org, 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, 4 Oct 2026
- Support channels
- The project lists Bugzilla for bug reports and mailing lists for bug reporting and discussion. · sourceware.org, 4 Oct 2026
Where GNU gprof stands on Freedom251
- Profiling Software#7 of 29