Chapter 5. Performance Analysis Tools and Documentation

Several different products are available to help you analyze your program's code and determine where optimization techniques can be applied. Many of these products are in the ProDev™ WorkShop suite of tools.

This chapter discusses the following topics:

All documentation mentioned in this chapter is available online or can be ordered. See the SGI Technical Publications Library at http://techpubs.sgi.com for details. In addition, the workshop (1) man page lists all man pages used with the performance tools and provides a summary of each performance tool product.

ProDev WorkShop Performance Analyzer

You can use the ProDev WorkShop Performance Analyzer to check your program for different performance problems. This tool has three major windows that display performance information:

  • The function list area, which shows functions and their performance metrics.

  • The system resource usage chart, which shows the mode of the program at any time.

  • The time line, which shows when sample events occur in experiments and controls the scope of analysis.

To conduct performance analysis, first run an experiment to collect performance data. You can specify the objective of your experiment through a task menu or with the SpeedShop ssrun(1) command. The Performance Analyzer reads the required data and provides charts, tables, and annotated code to help you analyze the results.

There are three general techniques for collecting performance data:

  • Counting: this involves counting the exact number of times each function or basic block has been executed.

  • Profiling: the program's program counter (PC), call stack, and/or resource consumption are periodically examined and recorded.

  • Tracing: events that impact performance, such as reads and writes, system calls, floating-point exceptions, and memory allocations, reallocations, and frees, can be traced.

The ProDev WorkShop Performance Analyzer is documented in the ProDev WorkShop: Performance Analyzer User's Guide.

ProDev WorkShop ProMP

ProMP is a companion product to the WorkShop suite of tools. It is used to analyze programs that have been parallelized. It is integrated with the other WorkShop tools to let you examine a program's loops in conjunction with a performance experiment on either a single processor or a multiprocessor run.

Before using ProMP, you must first compile your program with the appropriate auto-parallelizing options. The compiler then generates its output files and an analysis file, which ProMP then reads and analyzes.

The ProMP documentation includes several tutorials to help you learn to use the product; these tutorials cover the following topics:

  • Compiling a program for ProMP use

  • Viewing detailed information about code and loops

  • Examining loops with obstacles to parallelization

  • Examining nested loops

  • Modifying source files and recompiling the code

  • Using OpenMP directives

  • Using ProMP with performance data

The ProMP product is documented in the ProDev WorkShop: ProMP User's Guide.

ProDev Workshop Tester

ProDev WorkShop Tester is a quality assurance tool for test coverage over sets of tests. This product is used by software and test engineers and others involved in the development, testing, and maintenance of software projects.

WorkShop Tester has the following features:

  • It provides visualization of coverage data.

  • It provides useful measures of test coverage over a set of tests/experiments

  • It allows you to view the coverage results of a dynamically shared object (DSO) by executables that use it

  • It provides a comparison of coverage over different program versions

  • It provides tracing capabilities for function arcs that go beyond traditional test coverage tools

There are two versions of Tester: cvcov is the command line version of the test coverage program and cvxcov is the GUI version of the test coverage program.

Most of the functionality is available from either program, although the graphical representations of the data are available only from cvxcov, the GUI tool.

The Tester product is documented in the ProDev WorkShop: Tester User's Guide.

ProDev WorkShop Static Analyzer

The Static Analyzer is the WorkShop tool for examining the structure of a program's source code and the relationships between its parts, such as files, functions, and variables.

The Static Analyzer shows code structure, including how functions within programs call each other, where and how variables are defined, how files depend on each other, where macros are placed, and other structural details. The Static Analyzer is interactive, so you can quickly locate the portion of code structure that interests you, or you can step back for an overview. Because the Static Analyzer recognizes the connections between elements of the source code, you can readily trace how a proposed change to one element will affect related elements.

The Static Analyzer provides two modes for extracting static analysis data from your source files:

  • Scanner mode: a fast, general-purpose scanner that looks through code with minimal sensitivity to the programming language. Scanner mode does not require that your code compile.

  • Parser mode: a language-sensitive scanner that can be run at compile time by setting a switch.

The Static Analyzer is documented in the ProDev WorkShop: Static Analyzer User's Guide.

SpeedShop

The SpeedShop set of tools help you measure program performance using SpeedShop commands. These tools allow you to run experiments and generate reports that track down the sources of performance problems.

SpeedShop consists of a set of commands that can be run in a shell, an application programming interface (API) to provide some control over data collection, and a number of libraries to support the commands.

The following SpeedShop commands help you analyze your programs:

  • ssusage: Collects information about your program's use of machine resources. Output from ssusage can be used to determine where most resources are being spent.

  • ssrun: Allows you to run experiments on a program to collect performance data. It establishes the environment to capture performance data for an executable, creates a process from the executable (or from an instrumented version of the executable), and runs it.

  • sscompare: Analyzes performance data generated by ssrun and produces a comparison report. This allows you to compare the effects of different optimization techniques, for example, or to compare different experiments for the same application.

  • prof: Analyzes the performance data recorded with ssrun and provides formatted reports.

The following additional commands are also provided:

  • squeeze: Allocates a region of virtual memory and locks the virtual memory down into real memory, making it unavailable to other processes.

  • thrash: Allows you to allocate a block of memory, then access the allocated memory to explore system paging behavior.

The SpeedShop product is documented in the SpeedShop User's Guide.