14.3. gprof

Gprof is the Berkeley application profiling tool. Gprof provides a superset of the functionality available with prof, the System V version. Therefore, it is recommended that gprof be used rather than prof. Profiling an application with gprof involves the following steps:

Special compilation and linking
Program execution
Profile generation

14.3.1. Step 1: Special Compilation and Linking

Application profiling is available for programs written in the C, C++, Fortran, and Pascal languages. The program must be specially compiled with the -G switch to prepare the application for profiling. This special compiler option causes calls to the procedure _mcount() to be inserted at the beginning of every procedure. In addition to recording ...

Get HP-UX 11i Tuning and Performance now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.