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:

1.
Special compilation and linking
2.
Program execution
3.
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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.