Introduction to Sun WorkShop HomeContentsPreviousNextIndex


Chapter 6

Analyzing Program Performance

This chapter describes the basic features of the Sun WorkShop Sampling Collector and Sampling Analyzer. The UNIX prof and gprof performance-profiling tools generate only user CPU information. With the Sampling Collector and Sampling Analyzer, you can examine a wider range of metrics, broken down by functions, load objects, sampling intervals, or threads and lightweight processes (LWPs) in multithreaded programs:

For detailed information about how to use these and other performance-profiling tools included in Sun WorkShop, see:

Collecting Performance Data

The Sampling Collector gathers performance data about a program as it runs in the Debugging window. It stores the data in an experiment-record file, which you then load into the Sampling Analyzer.

TABLE 6-1 describes the types of data you can collect.

TABLE 6-1   Types of Data to Collect
Type Description
Clock-based profiling data Function or load-object timing information.
Thread-synchronization wait tracing data Wait time on calls to thread-synchronization routines in multithreaded programs.
Address-space data Information about how your application uses the pages and segments in its address space


The Collector automatically records global execution statistics, including page-fault and I/O data, context switches, and working-set and paging statistics. In the Collector you can also specify the length of sampling intervals during which data is collected, or choose to terminate each sampling interval manually.

For detailed information about choosing the types of data to collect and running the Collector, see:

Analyzing Performance Data

After you collect performance data with the Sampling Collector, you can view it in the Sampling Analyzer, a separate tool that you start from the Tools menu in the Sun WorkShop main window or the Sampling Collector window. The Analyzer's various displays pinpoint where your program is spending excessive execution time or otherwise making inefficient use of system resources.

The Sampling Analyzer window gives you a choice of four displays that you can choose from the Data list box (see TABLE 6-2).

TABLE 6-2   Types of Data to View and Analyze
Type Description
Function List display Shows detailed information about your program's functions and load objects.
Overview display Shows microstate accounting information for program sampling intervals.
Address Space display Shows use of pages or sectors in your program's address space.
Execution Statistics display Shows global statistics over the program execution time.


In the Analyzer displays, you can examine data for your whole program, or you can specify individual functions, load objects, sampling intervals, threads, and LWPs for analysis. You can also use the Analyzer to generate a mapfile that the linker can use to make your program more efficient in its use of the address space.

The Analyzer allows you to look at Function List data for more than one experiment record at a time. When you have more than one experiment loaded, data-filtering capabilities are disabled, as are the other displays.

For detailed information about how to use the Sampling Analyzer, see:

Examining Function and Load-Object Metrics

The Function List display shows for each function or load object the exclusive and inclusive values for the following metrics:

Each metric is displayed as an absolute value (seconds, counts) and as a percentage of the total program metric.

You can specify which of the available metrics you want to appear in the Function List display and the metric upon which the data is sorted. You can also open a window that lists all available metrics for a selected function or load object.

Examining Caller and Callee Metrics

From the Function List display, you can start the Callers-Callees window, where you can examine exclusive, inclusive, and attributed data for a selected function, its callers, and its callees. You can also step through the program structure by selecting callers or callees of the selected function, which then becomes the selected function. For more information, access the online help through the Help menu or the Help button in any window.

Displaying Annotated Source and Disassembly Code

To examine program performance line by line or instruction by instruction, you can display source code and disassembly code annotated with program metrics. These metrics enable you to pinpoint within a given function which line or lines are using up the most execution time. For more information, access the online help through the Help menu in any window.


Sun Microsystems, Inc.
Copyright information. All rights reserved.
Feedback
Library   |   Contents   |   Previous   |   Next   |   Index