After you collect performance data with the Sampling Collector, you can view it only through the Sampling Analyzer, a separate tool available from the Sun WorkShop main window or by choosing Collect > Analyze in the Sampling Collector window. The three types of data you can collect with the Sampling Collector separate into nine types of data available to analyze; each of these nine types of data has one or two Analyzer display options associated with it.
You can analyze the following types of data by selecting them from the Data list in the Sampling Analyzer window:
Process Times -- Summary of process state times (includes User Time, System Wait Time, System Time, Text Page Fault Time, and Data Page Fault Time)
User Time -- Time spent in the user process state from the execution of instructions
System Wait Time -- Time the process is sleeping in the kernel but is not in the suspend, idle, lock wait, text fault, or data fault state
System Time -- Time the operating system spent executing system calls
Text Page Fault Time -- Time spent faulting in text pages
Data Page Fault Time -- Time spent faulting in data pages
Program Sizes -- Sizes in bytes of the functions, modules, and segments of your application; in conjunction with Address Space data, allows you to examine the size of your application and helps you establish specific memory requirements
Address Space -- Reference behavior of both text pages and data pages; in conjunction with Program Sizes data, allows you to examine the size of your application and helps you establish specific memory requirements
Execution Statistics -- Overall statistics on the execution of the application
For more information on selecting a data type, see "Selecting Data Types" in the Sun WorkShop online help.
The Sampling Analyzer offers five ways to view collected performance data:
Overview -- The default display provides a high-level overview of the performance behavior of the application, including:
Number of samples that were taken during the collection process
Breakdown of the process activity for each sample during the collection process
Breakdown of the process activity averaged over selected samples
Percentage of the entire experiment that you're viewing
Histogram -- Summary of the amount of time spent executing functions, files, and load objects
Cumulative -- Cumulative amount of time spent by a function, file, or load object, including the time spent in called functions, files, or segments
Address Space -- Information about memory usage
Statistics -- Aggregate data about performance and system resource usage
For more information on selecting a display option, see "Selecting Display Options" in the Sun WorkShop online help.
By choosing View > New Window in a Sampling Analyzer window, you can open a new Analyzer window to compare two samples or view the same set of samples in two different ways.
If text page faults are consuming a lot of your application's time, the Sampling Analyzer can reorder your program, generating a mapfile containing an improved ordering of functions. With the most-used functions grouped together on the same set of pages, a function is more likely to already be in memory when called.
The --M option passes the mapfile to the linker, which then relinks your application and produces a new executable application with a smaller text address space size.
After you have reordered your application you can run a new experiment and compare the original version with the reordered one.
To reorder an application, compile the application using the --xF option.
The --xF option is required for reordering. This option causes the compiler to generate functions that can be relocated independently.
cc -xF -c a.c b.c cc -o application_name a.o b.o |
CC -xF -c a.cc b.cc CC -o application_name a.o b.o |
For Fortran applications, type:>
f77 -xF -c a.f b.f f77 -o application_name a.o b.o |
If you see the following warning message, check any files that are statically linked, such as unshared object and library files, because these files may not have been compiled with the --xF option:
ld: warning: mapfile: text: .text%function_name: object_file_name: Entrance criteria not met the named file, function_name, has not been compiled with the --xF option.
Load the application in Sun WorkShop for debugging.
Start the Sampling Collector by choosing Windows > Sampling Collector from the Debugging window.
Run the application in Sun WorkShop.
Load the specified experiment into the Sampling Analyzer.
Create a reordered map in the Sampling Analyzer by choosing Experiment > Create Mapfile. In the file chooser, enter the samples to be used, the mapfile directory, and the name of the mapfile to be created, and click OK.
The mapfile contains names of functions that have user CPU time associated with them. It specifies a function ordering that reduces the size of the text address space by sorting profiling data and function sizes in descending order. All functions not listed in the mapfile are placed after the listed functions.
Link the application using the new mapfile.
cc -Wl -M mapfile_name a.o b.o |
CC -M mapfile_name a.o b.o |
For C applications, the --M option causes the compiler to pass --M mapfile_name to the linker.
For Fortran applications, type:
f77 -M mapfile_name a.o b.o |
You can print a plain text version of the current display or a text summary of the experiment (including average sample times for each data type and the frequency of use of functions, modules, and segments). Choose Experiment > Print or Experiment > Print Summary in the Sampling Analyzer window and type the appropriate information in the dialog box.
You can export collected experiment data to files for use by other programs (such as spreadsheets or custom-written applications).
To export experiment data to an ASCII file: