Analyzing run-time behavior

Summary report

You can obtain a summary of profiling data by invoking lprof with the -s option:

$ lprof -s -c sample.cnt

Because a source listing is not produced by lprof -s, the -I option need not be specified. The summary reports the percentage of lines of code that were executed for each function in the profiled program, as shown in ``Example of lprof -s Output''.

       Coverage Data Source: sample.cnt
       Date of Coverage Data Source: Thu Apr 28 13:54:05 1994
       Object: sample

percent lines total function covered covered lines name

100.0 4 4 main 83.3 5 6 sub1 0.0 0 2 sub2 100.0 2 2 sub3

78.6 11 14 TOTAL

Example of lprof -s Output

To obtain both a source listing report and a summary report, you can invoke lprof with the -s and -p options. As an exercise, divide the sample.c file into four parts:

  1. sample.c containing main()

  2. sample1.c containing sub1()

  3. sample2.c containing sub2()

  4. sample3.c containing sub3()
For each .c file, build a profiled .o and link them to an executable that you name sample. Run sample to produce sample.cnt, and consider what the following command does:
   lprof -p -s -c sample.cnt -r sample3.c

Next topic: Merged data
Previous topic: Example of lprof -x Output

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