Using Options to Control Data Collection
You can use various options to specify how to collect profile information about your program.
•Collecting information on specific load modules.
•Improving HP Caliper performance by excluding load modules you don’t want to profile.
•Collecting information on specific processes.
You can specify HP Caliper data collection options by using the CALIPER_OPTSenvironment variable. In your Makefile or build scripts you can set CALIPER_OPTS to the options you want to use. HP Caliper uses those options when it is started by the compiler.
Here are some examples of ways you can control how HP Caliper collects optimization information.
Specifying PBO file names and locations
HP Caliper creates two files when doing
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_DATAand FLOW_LOGenvironment variables to specify the file names.
If the file you specify with the FLOW_DATAvariable 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 singleflow.data file. Combining profile information from multiple programs corrupts the flow.datafile. The file is designed to contain data from multiple runs of the same program with different input to help improve optimization results.
gprofThe 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 +gprofoption. For example: $ f90
2.Run the program. This creates the file gmon.outin 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 profilelists 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 gprofis finished, you can view the output tables using an ASCII editor.
For more information about gprof, see the gprof((1) )man page.
Using profilers 89