Analyzing Program Performance With Sun WorkShop

Basic Concepts

prof, gprof, and tcov extend the Sun WorkShop development environment to enable you to collect and use performance data. prof generates a program profile in a flat file. gprof generates a call graph profile. tcov generates statement-level information in a copy of the source file, annotated to show which lines are used and how often.

Table 4-1 lists these standard performance profiling tools.

Table 4-1 Performance Profiling Tools

Command 

Action 

prof

Generates a statistical profile of the CPU time used by a program, along with an exact count of the number of times each function is entered. This tool is included with the Solaris operating environment.  

gprof

Generates a statistical profile of the CPU time used by a program, along with an exact count of the number of times each function is entered and the number of times each arc (caller-callee pair) in the program's call graph is traversed. This tool is included with the Solaris operating environment. 

tcov

Generates exact counts of the number of times each statement in a program is executed. There are two versions of tcov: the original tcov and an enhanced tcov. They differ in the runtime support that generates the raw data used in the output. The original tcov obtains data from programs that are compiled with the -xa compiler option or the -a option (C++).