HP Fortran Programmer's Guide (March 2010)

Performance and optimization
Using profilers
Chapter 6148
For example, if you only want to measure wordplay, you would use these settings:
--module-default=none --module-include=wordplay
Specifying PBO file names and locations
HP Caliper creates two files when doing profile-based optimization:
flow.data The file name used to store profile data.
flow.log The file name used to log diagnostic messages.
You can use the FLOW_DATA and FLOW_LOG environment variables to specify the file names.
If the file you specify with the FLOW_DATA variable already exists when you run your program,
then HP Caliper merges the results of the current run in into the file.
CAUTION You cannot combine profile information from different programs into a single
flow.data file. Combining profile information from multiple programs corrupts
the flow.data file. The file is designed to contain data from multiple runs of
the same program with different input to help improve optimization results.
gprof
The gprof profiler enables you to determine which subprograms are called the most and how
much time is spent in each subprogram.To use gprof, do the following:
1. Compile the program with the +gprof option. For example:
$ f90 -o prog +gprof prog.f90
2. Run the program. This creates the file gmon.out in the current directory. For example:
$ prog
$ ls gmon.out
gmon.out
3. Run gprof, specifying the name of the program as an argument. It will display two tables
to standard output: a flat profile and a call graph profile. Since these tables can be quite
large, you may want to redirect the output from gprof, as follows:
$ gprof prog >gprof.out
The flat profile lists the number of times each subprogram was called and the percentage
of the total execution time for each of the subprogram times. The call graph profile
includes such information as the index of the function in the call graph listing, the
percentage of total time of the program accounted for by a routine and its descendents,
and the number of seconds spent in the routine itself.