HP aC++/HP C A.06.20 Programmer's Guide
The first line creates an intermediate file for instrumentation. The second line creates
optimized code with instrumentation.
Collecting Data for Profiling
To collect execution profile statistics, run your instrumented program with
representative data as follows:
sample.exe < input.file1
sample.exe < input.file2
This step creates and logs the profile statistics to a file, by default called flow.data.
The data collection file is a structured file that may be used to store the statistics from
multiple test runs of different programs that you may have instrumented.
Maintaining Profile Data Files
Profile-based optimization stores execution profile data in a disk file. By default, this
file is called flow.data and is located in your current working directory.
You can override the default name of the profile data file. This is useful when working
on large programs or on projects with many different program files.
The FLOW_DATA environment variable can be used to specify the name of the profile
data file with either the +Oprofile=collect or +Oprofile=use options.
Example 1
In the following example, the FLOW_DATA environment variable is used to override
the flow.data file name. The profile data is stored instead in /users/profiles/
prog.data.
export FLOW_DATA=/users/profiles/prog.data
aCC -c +Oprofile=collect sample.C
aCC -o sample.exe +Oprofile=collect sample.o
sample.exe < input.file1
aCC -o sample.exe +Oprofile=use +O3 sample.o
Example 2
In this example, the +Oprofile=use:filename option is used to override the
flow.data file name with the name /users/profiles/prog.data.
aCC -c +Oprofile=collect sample.C
aCC -o sample.exe +Oprofile=collect sample.o
sample.exe < input.file1
mv flow.data /users/profile/prog.data
aCC -o sample.exe +Oprofile=use:/users/profiles/prog.data +O3 sample.o
Performing Profile-Based Optimization
To optimize the program based on the previously collected runtime profile statistics,
relink the program as follows:
206 Optimizing HP aC++ Programs