Tool Mentor: Finding Performance Bottlenecks Using Rational Quantify and Rational
PurifyPlus (UNIX)
Purpose
This tool mentor provides an overview of how to use Rational Quantify® to quickly
pinpoint performance bottlenecks in your programs. PurifyPlus is a Rational
product that includes Quantify functionality.
To learn more about Quantify and for step-by-step instructions, read the Installing
and Getting Started manual for the PurifyPlus product family (UNIX version).
For step-by-step instructions for using Quantify and for reference
information, see Quantify online Help.
Related Rational Unified Process information:
Overview
Quantify provides a complete, accurate, and easy-to-interpret set of performance
data for your program and its components (including threads), so that you can
identify and eliminate performance bottlenecks in your code.
Tool Steps
To profile a program's performance:
- Run a program under Quantify to collect performance
data
- Analyze the performance data
- Eliminate bottlenecks and rerun to verify improvements
1. Run a program under Quantify to collect
performance data
The first step in improving your program's performance is to collect performance
data.
Just add the word quantify to the
beginning of your compile/link line. Quantify collects performance data at the
function level and, if you compile with the -g
debugging option, at the line level. For example:
% quantify cc -g hello_world.c
Quantify makes a copy of your object code and libraries, and instruments it
using Object Code Insertion (OCI) technology to insert instructions for
collecting performance data. When instrumentation is complete, run the
instrumented program. For example:
% a.out
As you exercise your code, Quantify records data about its performance. You can
call Quantify API functions from your program to pause and resume data recording
at any time, so that you can concentrate on specific portions of code.
When you exit the program, Quantify displays the Quantify Control Panel,
from which you can access its data analysis windows and begin analyzing your
program's performance.
Tip: In addition to using Quantify interactively, you can also use it
with your test scripts, makefiles, and batch files for automated testing. View
output from your tests using the command:
qv a.out.<process id>.<sequence
number>.qv
For more
information, look up the following topics in the Quantify online Help index:
- basic steps
- scripts
- options
- API functions
2. Analyze the performance data
The second step in improving your program's performance is to analyze the
performance data that Quantify has collected.
From the Quantify Control Panel, which is displayed when you exit the
program for which you have been collecting data, you can open the Call
Graph window or the Function List window to examine the data in different
formats. From these windows you can open the Function Detail window and the
Annotated Source window.
The Call Graph window displays a schematic representation of the
calling structure and performance of the functions in the program. By default,
the call graph displays the 20 functions that contributed most to the overall
time of the program. As you examine your program's performance, you can show
additional functions, hide functions, and focus on the specific functions and
their descendants that are most critical for your work.
The Function List window displays in table format the statistics for
the functions. You can sort them on the basis of a large number of criteria,
such as the time the program spends in the function, the time the program spends
in the function and its descendants, and the number of calls the function makes.
The Function Detail window displays data for a specific function, and
data about its callers and descendants.
The Annotated Source window displays line-by-line performance data on
a copy of your source code. This is available if you compiled with the -g
debugging option.
Quantify's results include virtually no overhead from the profiling process
itself. The numbers you see are the time your program would take without
Quantify.
With the data you collect, you will be able to identify performance
bottlenecks such as needless computations or recomputations, premature
computations, or excessive and expensive library calls.
For more
information, look up the following topics in the Quantify online Help index:
- call graph
- function list
- function detail
- annotated source
- bottlenecks
3. Eliminate bottlenecks and rerun to verify
improvements
The third and final step in improving your program's performance is to modify
your code to eliminate bottlenecks, and then compare "before" and
"after" performance data to see whether the modifications have caused
the performance to improve or regress.
After you modify your code, you can rerun the updated program and use
Quantify's qxdiff script to compare
the new results to any previous run.
You can save performance data as a Quantify data file (.qv) to use for
further analysis or to share with other Quantify users. You can save data in
export format for use outside of Quantify.
For more
information, look up the following topics in the Quantify online Help index:
Copyright
© 1987 - 2001 Rational Software Corporation
|