Oracle Developer Studio feedback profiling enables you to optimize the binaries of the application. In feedback profiling, you build the application twice, once to collect the profile data and again to make use of the profile to generate an optimal code.
This use case uses the following procedure for feedback profiling.
Sets the environment variable SUN_PROFDATA_DIR to provide the location of the profile directory that will be generated.
# setenv SUN_PROFDATA_DIR /tmp/consolidate
The profile directory is stored in the /tmp/consolidate folder.
Sets the environment variable SUN_PROFDATA to record the profile data of the product in a single file.
# setenv SUN_PROFDATA singlefeedbin.profile
The profile data is stored in the singlefeedbin.profile file.
Compiles the binaries by using the –xprofile option.
-xprofile={collect,tcov}:xxx.profile
The –collect option helps in collection of data about the program and the –tcov option provides the code coverage after the execution of the program.
Runs the application with representative workloads that resembles the real-time environment.
The information about the behavior of the program during these runs is saved in the .profile directory that is created in step 2.
Recompiles the binaries by using the profile data.
-xprofile=use:/path/to/xxx.profile
The –use option performs the following optimizations based on the profile data:
Code layout
Register allocation
Loop transformations
Branch optimizations
Block straightening
Switch case code generation
Global instruction scheduling
Delay slot scheduling
Branch prediction