DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Analyzing run-time behavior

How to use the profilers

To use these profilers, you must follow a three-step procedure:


Step 1:
Compile and link the program with a profiling option.

for prof: $ cc -qp (or -p)
for lprof: $ cc -ql
for fprof: $ cc -qf

or

Compile the program normally, then use fur to insert the profiling code (for fprof, prof or block profiling):

for prof: -P prof.o -p all
for fprof: -p all -e all
for block profiling: -b all

Then, for prof and fprof link with -qp and -qf respectively. For block profiling, link normally.


Step 2:
Run the profiled program. At the end of execution, run-time data is written to a file known as a data file or log.

Step 3:
Analyze the data. For prof and lprof, the commands to analyze the data are prof and lprof, respectively. By default, both profilers expect a.out as the input. Both permit specification of a differently named program on the command line and both accept data files as input.

For fprof-type logs, there are two different tools used to analyze the data: fprof and lrt_scan. The former is used for performance analysis (and statistics), while the latter is used for tuning
locality of reference. For block profiling, just run fur on the output files.

For further details of profiler usage, see fprof(CP), fur(CP), lrt_scan(CP), prof(CP) and lprof(CP).


Next topic: Using lprof
Previous topic: Profiling utilities

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005