Runtime profiling (prof, gprof)

The prof and gprof commands provide different levels of runtime profile reports, which you can examine to find performance bottlenecks and identify the subprograms that are called most or least often.

This information can help you decide where to concentrate performance-tuning efforts.

See -p for information on compiling for profiling and an example of the sequence of commands.