User's Guide

When using profile-based optimization, please note the following:
Numerical applications that perform the same calculations independent of the input data will
only see a small performance boost.
Profile-based optimization has the greatest impact on application performance when used
with level 2 or greater optimizations.
Profile-based optimization benefits most applications, especially large applications with multiple
compilation units, such as compilers, editors, database managers, and user interface managers.
Profile-based optimization should be enabled during the final stages of application development.
To obtain the best performance, reprofile and reoptimize your application after making source
code changes.
These steps are involved in performing profile-based optimization:
1. Instrumentation
2. Collecting Data for Profiling
3. Maintaining Profile Data Files
4. Performing Profile-Based Optimization
Instrumentation
To instrument your program, use the +Oprofile=collect option as follows:
aCC +Oprofile=collect -O -c sample.C
aCC +Oprofile=collect -O -o sample.exe sample.o
The first command line uses the +Oprofile=collect option to prepare the code for
instrumentation. The -c option in the first command line suppresses linking and creates an object
file called sample.o.
The second command line uses the -o option to link sample.o into sample.exe. The
+Oprofile=collect option instruments sample.exe with data collection code.
NOTE: Instrumented programs run slower than non-instrumented programs. Only use instrumented
code to collect statistics for profile-based optimization.
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.
The +Oprofile=use:filename command line option can be used to specify the name of the
profile data file when used with the +Oprofile=use option.
Requesting Optimization 159