-p

Category

Optimization and tuning

@PROCESS

None.

Purpose

Prepares the object files produced by the compiler for profiling.

The compiler produces monitoring code that counts the number of times each routine is called. The compiler inserts a call to the monitor subroutine at the start of each subprogram.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -p--+---+--------------------------------------------------><
        '-g-'   

Defaults

Not applicable.

Usage

When you run a program compiled with -p and it ends normally, it produces a mon.out file with the profiling information. You can then use the prof command to generate a runtime profile.

-pg is like -p, but it produces more extensive statistics. Running a program compiled with -pg produces a gmon.out file, which you use with the gprof command to generate a runtime profile.

Examples

$ xlf95 -p needs_tuning.f
$ a.out
$ prof
 .
 .
 .

profiling data
 .
 .
 .

$ xlf95 -pg needs_tuning.f
$ a.out
$ gprof
 .
 .
 .

detailed and verbose profiling data
 .
 .
 .

Related information