Collect or optimize with runtime profiling data.
SPARC: 77/90 x86:77
p must be one of collect[:nm], use[:nm], or tcov. Optimization level must be -O2 or greater.
collect[:nm]
Collect and save execution frequency data for later use by the optimizer with -xprofile=use. The compiler generates code to measure statement execution frequency.
The nm is the name of the program that is being analyzed. This name is optional. If nm is not specified, a.out is assumed to be the name of the executable.
At runtime a program compiled with -xprofile=collect:nm will create the subdirectory nm.profile to hold the runtime feedback information. Data is written to the file feedback in this subdirectory. If you run the program several times, the execution frequency data accumulates in the feedback file; that is, output from prior runs is not lost.
use[:nm]
Use execution frequency data to optimize strategically.
As with collect:nm, the nm is optional and may be used to specify the name of the program.
The program is optimized by using the execution frequency data previously generated and saved in the feedback files written by a previous execution of the program compiled with -xprofile=collect.
The source files and other compiler options must be exactly the same as used for the compilation that created the compiled program that generated the feedback file. If compiled with -xprofile=collect:nm, the same program name nm must appear in the optimizing compilation: -xprofile=use:nm.
tcov
Basic block coverage analysis using "new" style tcov.
Code instrumentation is similar to that of -a, but .d files are no longer generated for each source file. Instead, a single file is generated, whose name is based on the name of the final executable. For example, if stuff is the executable file, then stuff.profile/tcovd is the data file.
When running tcov, you must pass it the -x option to make it use the new style of data. If not, tcov uses the old .d files, if any, by default for data, and produces unexpected output.
Unlike -a, the TCOVDIR environment variable has no effect at compile-time. However, its value is used at program runtime to identify where to create the profile subdirectory.
See the tcov(1) man page, the Performance Profiling chapter of the Fortran Programming Guide, and the Analyzing Program Performance with Sun WorkShop manual for more details.