Optimizing Itanium-Based Applications (May 2011)
Optimizing Itanium-Based Applications
21
cc -o sample.exe +Oprofile=use -O sample.o Link for optimization.
The +Oprofile=use option is supported at optimization level 2 (-O or +O2) and above.
Note: Profile-based optimization has a greater impact on application performance at each higher level of
optimization. Profile-based optimization should be enabled during the final stages of application
development. To obtain the best performance, re-profile and re-optimize your application after making
source code changes.
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. To select an alternate profile data file X, use the +Oprofile=use:X command line option. You
can also use the FLOW_DATA environment variable to specify the name of the profile data file with the
+Oprofile=use compile. The [:file] qualifier takes precedence over the FLOW_DATA environment
variable. In the following example, the FLOW_DATA environment variable is set to override the flow.data
file name. The profile data is stored instead in /users/profiles/prog.data.
% cc -Aa -c +Oprofile=collect sample.c
% cc -o sample.exe +Oprofile=collect sample.o
% setenv FLOW_DATA /users/profiles/prog.data
% sample.exe < input.file1
% cc -o sample.exe +Oprofile=use +03 sample.o
In the next example, the Oprofile=use: option uses /users/profiles/prog.data to override
the flow.data file name.
% cc -Aa -c +Oprofile=collect sample.c
% cc -o sample.exe +Oprofile=collect sample.o
% sample.exe < input.file1
% mv flow.data /users/profile/prog.data
% cc -o sample.exe +Oprofile=use:/users/profiles/prog.data +03 sample.o
merging profile data files
Execution profile data files from different runs of an instrumented executable can be merged together into
a single file. This merging can take place implicitly during data collection, or it may be performed
explicitly by the user using the “fdm” command, This example shows an implicit merge:
% aCC +O3 -c +Oprofile=collect program.C
% aCC -o program.exe +Oprofile=collect program.o
% setenv FLOW_DATA /tmp/program.flow
% sample.exe < A.input Profile for input “A.input” written to /tmp/program.flow
% sample.exe < B.input Profile for input “B.input” merged into /tmp/program.flow
During the second run of the instrumented executable, the execution profile data derived from running the
program on “B.input” is merged with (added to) the existing profile database /tmp/program.flow. Profile
databases may also be merged explicitly using the tool /opt/langtools/bin/fdm. Here is an
example of an explicit merge:
% unset FLOW_DATA ; rm flow.data