HP Fortran Programmer's Guide (B3908-90031; September 2011)

Performance and optimization
Using profilers
Chapter 6146
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.
4. Once gprof is finished, you can view the output tables using an ASCII editor.
For more information about gprof, see the gprof(1) man page.
prof
The prof profiler can also be used for profiling. Unlike the gprof profiler, prof does not generate the call
graph profile. To use prof, do the following: