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(1), fur(1), lrt_scan(1), prof(1) and lprof(1).


Next topic: Using lprof
Previous topic: Profiling utilities

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004