Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial
Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under
vendor's standard commercial license. The information contained herein is subject to change without notice. The only warranties for HP products
and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as
constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.
UNIX is a registered trademark of The Open Group.
Intel® and Itanium® are registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
Contents
HP secure development lifecycle....................................................................12
About This Document...................................................................................13
1 HP Caliper at a Glance............................................................................17
What is HP Caliper?...............................................................................................................17
What Does HP Caliper Run On?..............................................................................................19
Supported Hardware and Operating Systems........................................................................19
Supported Compilers and Application Environments...............................................................19
Summary of HP Caliper Features..............................................................................................20
2 Getting Started with the HP Caliper Command-Line Interface..........................21
Example: Running fprof on a Short Program, with Default Output..................................................21
Example: Adding Instructions to an fprof Report..........................................................................25
Types of Measurements...........................................................................................................27
Global Measurement..........................................................................................................27
Starting with HP-UX 11i v3 March 2013 update release, HP secure development lifecycle provides
the ability to authenticate HP-UX software. Software delivered through this release has been digitally
signed using HP's private key. You can now verify the authenticity of the software before installing
the products, delivered through this release.
To verify the software signatures in signed depot, the following products must be installed on your
system:
•B.11.31.1303 or later version of SD (Software Distributor)
•A.01.01.07 or later version of HP-UX Whitelisting (WhiteListInf)
To verify the signatures, run: /usr/sbin/swsign -v –s <depot_path>. For more information,
see Software Distributor documentation at http://www.hp.com/go/sd-docs.
NOTE:Ignite-UX software delivered with HP-UX 11i v3 March 2014 release or later supports
verification of the software signatures in signed depot or media, during cold installation.
For more information, see Ignite-UX documentation at http://www.hp.com/go/ignite-ux-docs.
About This Document
This document describes how to use HP Caliper to measure the performance of native applications
running on HP-UX and Linux Integrity servers.
NOTE:For the latest version of this document, go to the HP Caliper Web site at the following
URL and click on Documentation in the Product Information box:
http://hp.com/go/caliper
This document is sometimes updated after a release. The document publication date appears on
the title page.
Intended Audience
This document is written for software developers who want to improve the performance of their
application programs. It assumes that you are familiar with compilers and with performance analysis
concepts. It is not necessary for you to have used a performance analysis tool before to use HP
Caliper.
New and Changed Information in This Edition
New Information
The HP Caliper 5.7 release has the following improvements:
•Improved accuracy in some of the CPU metrics measurement for Intel® 9500 processors.
•Quality improvements and defect fixes.
Deprecated Options
None
Deleted Information
None.
Document Organization
For information to help you get started, read these chapters:
•“HP Caliper at a Glance” (p. 17) provides an introduction to HP Caliper.
•“Getting Started with the HP Caliper Command-Line Interface” (p. 21) helps you get started
using the HP Caliper command-line interface.
•“Getting Started with the HP Caliper GUI” (p. 32) introduces you to the HP Caliper graphical
user interface (GUI).
For more advanced information, read these chapters:
•“HP Caliper Options” (p. 48) describes the HP Caliper options in alphabetical order.
13
For information about the HP Caliper Advisor, read this chapter:
•“Using the HP Caliper Advisor” (p. 77).
For information about how to configure HP Caliper to collect data and report the results, read these
chapters:
•“Configuring HP Caliper ” (p. 92) describes how you can configure HP Caliper to collect
data.
•“Controlling the Content of Reports” (p. 105) describes how to control the content of reports
based on the data collected.
For information about how to run particular measurements, read these chapters:
•“Producing a Sampled Call Graph Profile Analysis” (p. 122) describes how to use HP Caliper
to produce a sampled call graph profile analysis.
•“Producing a Sampled Call Stack Profile Analysis” (p. 134) describes how to use HP Caliper
to produce a sampled call stack profile analysis.
•“Performing CPU Metrics Analysis” (p. 153) describes how to measure CPU metrics on
HP-UX.
For information about HP Caliper features specific to HP-UX, read this chapter:
•“HP Caliper Features Specific to HP-UX” (p. 154).
Also see these appendixes:
•“HP Caliper Diagnostic and Warning Messages” (p. 167) describes some diagnostic and
warning messages you might receive.
•“Descriptions of Measurement Reports” (p. 171) provides descriptions of reports produced for
all of the HP Caliper measurements.
•“Event Set Descriptions for CPU Metrics” (p. 232) contains descriptions for the output of
each event set available with the cpu measurement.
Typographic Conventions
This document uses the following typographic conventions:
$The system prompt for the Bourne, Korn, and POSIX shells.
audit(5)A manpage. The manpage name is audit, and it is located in
Section 5.
CommandA command name or qualified command phrase.
Computer outputText displayed by the computer.
Ctrl+xA key sequence. A sequence such as Ctrl+x indicates that you
must hold down the key labeled Ctrl while you press another key
or mouse button.
ENVIRONMENT VARIABLEThe name of an environment variable, for example, PATH.
ERROR NAMEThe name of an error, usually returned in the errno variable.
File nameThe name of a file, a measurement, or an event set.
KeyThe name of a keyboard key. Return and Enter both refer to the
same key.
TermThe defined use of an important word or phrase.
User inputCommands and other text that you type.
14
VariableThe name of a placeholder in a command, function, or other
syntax display that you replace with an actual value. An example
is program, where the actual file name will vary.
GUI itemA graphical user interface (GUI) item such as a button or menu
name.
[]The contents are optional in syntax. If the contents are a list
separated by |, you must choose one of the items.
{}The contents are required in syntax. If the contents are a list
separated by |, you must choose one of the items.
...The preceding element can be repeated an arbitrary number of
times.
|Separates items in a list of choices.
Related Documents
The complete HP Caliper documentation set contains the following:
•HP Caliper Quick Start
•HP Caliper User Guide
•HP Caliper Advisor Rule Writer Guide
•HP Caliper for HP-UX Release Notes
•HP Caliper for Linux Release Notes
•HP Caliper Ktrace Features Guide
You can get more information about HP Caliper in these ways:
•An HP Caliper man page is provided. Type: man caliper
•Help text:
To get short help text, type caliper -h or caliper -?.
To get long help text, type caliper -H or caliper --help.
•To get help in the HP Caliper GUI, in the Help menu, select:
Help Contents for a listing of types of help you can see, including “getting started” help
◦
and reference help
◦Context-sensitive Help for help on windows in the GUI
•Useful information is available in the HP Caliper home directory. The default HP Caliper home
directory is /opt/caliper/ on HP-UX and /opt/hp-caliper/ on Linux. See these
subdirectories:
◦Documentation is located in the doc subdirectory.
◦The doc/text subdirectory contains the help files for the textual report descriptions as
well as other useful information.
◦Example files are located in the examples subdirectory.
•You can find the most recent software and information on the HP Caliper Web site at:
http://hp.com/go/caliper
The Usage Notes at the HP Caliper Web site are a collection of technical notes explaining details
about HP Caliper and the performance monitoring unit (PMU) used in HP Integrity servers. See
these examples:
•Using HP Caliper to identify a CPU- or memory-related performance problem
•Using HP Caliper to perform bubble analysis on a simple example program
•Using HP Caliper to measure integer load latency
15
•Using HP Caliper to analyze effective floating-point load latency
•Using HP Caliper with an application program to characterize the Itanium memory hierarchy
•Using HP Caliper to measure performance data related to translation lookaside buffers (TLBs)
You can also read these technical reports about the microarchitecture used in HP Integrity servers:
•Dual-Core Update to the Intel® Itanium® 2 Processor Reference Manual for Software
Development and Optimization, Document Number 308065-001.
•Intel® Itanium® 2 Processor Reference Manual for Software Development and Optimization,
Document Number 251110-003.
•Introduction to Microarchitectural Optimization for Intel Itanium 2 Processors Reference Manual,
Document number 251464-001, Intel Corporation, 2002.
•Itanium 2 Processor Microarchitecture, Cameron McNairy and Don Soltis, IEEE Micro, IEEE
Computer Society, March-April 2003, pages 44-55.
•A Methodology for using the Intel Itanium 2 performance counters for bottleneck analysis,
Sverre Jarp, Hewlett-Packard Laboratories, August 2002.
•Performance Profiling for Fun and Profit, Jim Callister and Susith Fernando of Intel Corporation
and Stephane Eranian and David Mosberger of Hewlett-Packard Company, 24 May 2005.
HP Encourages Your Questions
You can get help with using and understanding HP Caliper by sending email to the HP Caliper
development team. Please send questions to caliper-help@cup.hp.com.
You can also see the HP Caliper Technical Support Web page.
16
1 HP Caliper at a Glance
What is HP Caliper?
HP Caliper is a general-purpose performance analysis tool for applications on HP-UX and Linux
systems running on HP Integrity Servers. HP Caliper allows you to understand the performance
and execution of your application and to identify ways to improve its run-time performance.
HP Caliper works with any native Integrity Server application. It does not require special compilation
of the program being analyzed and does not require any special link options or libraries. HP
Caliper supports programs compiled with any compiler option.
HP Caliper provides ways to:
•Measure the overall performance of a program
•Identify performance parameters of specific functions in a program
•Guide you in optimizing the performance of a program based on its specific execution profile
HP Caliper has two user interfaces:
•Graphical user interface (GUI)
•Command-line interface (CLI)
These two interfaces are part of the same product. You can mix-and-match your use of the GUI
and the command line.
The GUI can run either natively (locally) on the HP-UX or Linux Integrity server that HP Caliper is
running on, or remotely on a Windows x86 or Linux x86 desktop system.
HP Caliper operates in these modes:
•Data collection
•Report generation
•Performance analysis
The data collection output is saved automatically in a database for possible use later. Report
generation can be done in the data collection run or in separate report generation runs later.
The output data is delivered in multiple report formats, with source and assembly code, and
explanatory help text.
Figure 1 shows the HP Caliper components.
What is HP Caliper?17
Figure 1 HP Caliper Components (User Interfaces)
HPCaliperCLI
Performance
reports
HPCaliper
database(s)
IntegrityServer(HP-UXorLinux)
X86desktop(WindowsorLinux)
Application
HPCaliper
HPCaliperGUI
(local)
HPCaliperGUI
(remote)
X11
server
HP Caliper selectively measures the processes, threads, and load modules of your application. HP
Caliper performs data collection in one of two modes:
•System-wide: In a system-wide measurement, HP Caliper measures activity across the entire
system, and attributes measurements to the kernel and individual processes where possible.
•Per-process: In a per-process measurement, HP Caliper tracks individual processes and their
children and measures each separately.
HP Caliper uses the performance monitoring unit (PMU) of the Itanium processor family to gather
the requested performance data. This is done primarily through non-intrusive sampling, both
time-based and event-based, as well as exact counts of particular metrics. HP Caliper provides
data on hundreds of events monitored by the PMU.
On HP-UX, it also uses dynamic instrumentation of code for some measurements. It only instruments
the portions of the application that actually get executed, thus eliminating unnecessary
instrumentation overhead.
Reports show measured data by thread, load module, function, statement, and instruction.
HP Caliper uses a single command (called caliper) for all measurements. You specify the type
of measurement and the target program as command-line arguments.
For example:
$ caliper myprog
This command uses a default measurement called scgprof to produce a sampled call graph
profile of the program myprog. The result of the measurement (the output) is saved automatically
in a database. The output database is called scgprof and is placed in a databases directory in
your current directory unless you specify otherwise.
By default, a text report describing the results of the measurement run is sent to stdout.
Using the HP Caliper GUI, you have access to all of HP Caliper's features and options using intuitive
menus and buttons.
HP Caliper has many types of preconfigured measurements that can be performed on a program.
For example, there are measurements to determine cache misses, stalls, and call graphs. You can
further customize your measurements by using HP Caliper options as parameters to the caliper
command.
18HP Caliper at a Glance
In general, HP Caliper runs do one of the following:
•Collect data
•Collect data and generate a report
•Generate a report based on previously collected data
•Analyze previously collected data
For the last item above, HP Caliper provides the HP Caliper Advisor, a rules-based expert system
designed to provide guidance about improving the performance of an application. Users can write
their own rules to analyze applications or use the default rules provided.
The latest version of HP Caliper is available on the HP Caliper home page at:
http://hp.com/go/caliper
What Does HP Caliper Run On?
Supported Hardware and Operating Systems
HP Caliper is supported on HP Integrity systems. HP Caliper does not measure programs compiled
for PA-RISC processors.
HP Caliper is supported on these operating systems:
•HP-UX 11i v2 or later
•Linux version 2.6: RedHat4, Debian 3.0, and SuSE Enterprise Linux 9
HP Caliper can be used in an Integrity Virtual Machine environment on a guest system.
Supported Compilers and Application Environments
On HP-UX, HP Caliper is formally supported for HP C/aC++ and HP Fortran. (These are also the
compilers it is bundled with.) HP Caliper measures code generated by these native and cross
compilers, including inlined functions and C++ exceptions. Instrumentation-based measurements
will only work on applications compiled on these compilers.
On Linux, HP Caliper has been primarily validated with code produced with gcc and g++, and
minimally tested with code produced from the Intel icc compiler.
HP Caliper can generally be used on:
•Programs compiled using HP, Intel, and GNU compilers, with and without optimization.
•Assembly and Java programs.
•Stripped programs, and programs compiled with optimization or debug information or both.
This includes support for both the +objdebug and +noobjdebug options.
•Both ILP32 (+DD32) and LP64 (+DD64) programs, both 32-bit and 64-bit ELF formats.
•Archive-, minshared- or shared-bound executables.
•Single-process and multiprocess applications.
•Single-threaded and multithreaded applications, including MxN threads.
•Applications that fork or vfork or exec themselves or other executables.
•Shell scripts and the programs they spawn.
•Main, static, and dynamic shared libraries.
•Entire run, partial run, and server/daemon programs.
What Does HP Caliper Run On?19
Summary of HP Caliper Features
HP Caliper's most important features include the following:
•Performance data is automatically saved in databases, which you can use to generate reports
without having to remake the measurements. Multiple databases can also be combined for
aggregated results.
•All reports are available in text format and comma-separated-value (CSV) format for use with
spreadsheets.
•The HP Caliper GUI can be used to set up measurements, initiate measurement runs, and
interactively explore collected performance data.
•Performance data can be correlated to your source program by line number.
•You can include or exclude specific load modules, such as libc, when measuring performance.
•Both per-thread and aggregated thread reports are available for most measurements.
•Performance data can be reported by function, sorted to show hot spots.
•You can perform per-process and system-wide measurements, for user or kernel space. The
system-wide measurement data can be attributed to the kernel, processes, or processes and
modules, or not attributed.
•Multiprocess selection capabilities are provided.
•Limited support for dynamically generated code is provided.
•Disassembly listings (template types, symbolic branch targets, branch targets as function offsets,
optional marked branch target instructions) are provided.
•Support for command-line options from a file is provided.
•The ability to attach and detach to running processes for certain measurements is provided.
•You can use the Advisor expert system to analyze applications, using either the default rules
or rules you write yourself.
•On HP-UX, you can restrict PMU measurements to specific regions of your program.
•On HP-UX, there is full support for AAS executables (applications using Adaptive Address
Space).
20HP Caliper at a Glance
2 Getting Started with the HP Caliper Command-Line
Interface
This chapter provides some example programs to show you how to get started using the HP Caliper
command-line interface. The programs are chosen for illustration purposes and are not necessarily
representative of programs you might actually want to analyze.
Example: Running fprof on a Short Program, with Default Output
HP Caliper provides many types of performance measurements. You typically specify which type
of measurement to perform by the first argument to the caliper command.
A good measurement to start with is fprof (flat profile), which will show you the parts of your
application that have the highest CPU usage. When you specify fprof, HP Caliper samples your
application's instruction pointer (IP) at regular intervals (every 500,000 CPU cycles by default)
and reports which functions and source lines incurred the most IP sample hits. Because HP Caliper
uses samples, rather than precise counts, measurement intrusion is kept to a minimum.
To illustrate, let us collect fprof data on a run of an example program called matmul. First, we
will compile matmul with full optimization enabled:
$ /opt/ansic/bin/cc -Aa +O3 -o matmul matmul.c
Now we will have HP Caliper collect performance data for one run of matmul:
$ caliper fprof ./matmul
Once matmul exits, HP Caliper writes a text report to stdout (by default) as shown in
Figure 2 (page 22).
The numbers (which are bold in the PDF version of this guide) are annotations to explain the
report—they are not part of the output you receive. See the list at the end of the report for the
explanations.
Example: Running fprof on a Short Program, with Default Output21
Figure 2 fprof Measurement Report for matmul, with Default Report Output
================================================================================
HP Caliper 4.3.0 Report Summary for Flat Profile
================================================================================
Collection Run 1: (Flat Profile)
2
---------------------------------
Processor Information
3
Machine name: fitzroy
Number of processors: 4
Processor type: Itanium2 9M
Processor speed: 1600 MHz
Virtual machine: no
Run Information
4
Configuration: /opt/caliper/config/fprof
Date: May 05, 2007
Version: HP Caliper - HP-UX Itanium Version 4.3.0 (2007-05-05)
OS: HP-UX B.11.23 U ia64
Database: /home/meagher/.hp_caliper_databases/fprof
Measurement scope: per-process
1
Sampling Specification
5
Sampling event: CPU_CYCLES
Sampling period: 500000 events
Sampling period variation: 25000 (5.00% of sampling period)
Sampling counter privilege: user (user-space sampling)
Data granularity: 16 bytes
Data sampled: IP
Program: /home/meagher/matmul
Invocation: ./matmul
Process ID: 6991 (started by Caliper)
Start time: 09:31:37 AM
End time: 09:31:38 AM
Termination Status: 1
Last modified: May 5, 2007 at 09:09 AM
Memory model: ILP32
Processor set: default
22Getting Started with the HP Caliper Command-Line Interface
Target Execution Time
10
Real time: 0.428 seconds
User time: 0.415 seconds
System time: 0.008 seconds
Sampling Specification
11
Number of samples: 1319
Data sampled: IP
Metrics Summed for Entire Run
12
---------------------------------------------- PLM
Event Name U..K TH Count
HP Caliper 4.3.0: Report Summary for Flat Profile: The heading for the report, including
the HP Caliper version number and the measurement (Flat Profile).
2
Collection Run 1: (Flat Profile): The heading for the run.
3
Processor Information: Information about your processor.
4
Run Information: Information about the run.
5
Sampling Specification: Information about what was being measured.
6
Metrics Summed for Entire Run: Metrics for the entire run are summed:
•CPU_CYCLES is the number of elapsed processor cycles. (CPU_CYCLES is known as
CPU_OP_CYCLES.ALL on the Integrity servers dual-core Itanium 2 and Itanium 9300
quad-core processors.)
•BACK_END_BUBBLE.ALL is full pipe bubbles in the main pipe.
•BE_EXE_BUBBLE.GRALL is full pipe bubbles in the main pipe due to execution unit stalls.
7
Process Summary:
8
Flat Profile Report for matmul: This is a low-level report for the single process that is measured
for this collection run.
For each collection run, one low-level report is produced for each process. A low-level report
can be: data for a single process, data for a group of “matching” processes, or a
module-centric view of all processes.
9
Target Application: Information about your application.
10
Target Execution Time: How long the run took.
11
Sampling Specification: Information about what was being measured.
12
Metrics Summed for Entire Run: Metrics for the entire run are summed. CPU_CYCLES is the
number of elapsed processor cycles. (CPU_CYCLES is known as CPU_OP_CYCLES.ALL on
the Integrity servers dual-core Itanium 2 and Itanium 9300 quad-core processors.)
BACK_END_BUBBLE.ALL is full pipe bubbles in the main pipe. BE_EXE_BUBBLE.GRALL is
full pipe bubbles in the main pipe due to execution unit stalls.
13
Load Module Summary:
•% Total IP Samples: Percent of the total IP samples attributable to a particular load
module.
•Cumulat % of Total: Running sum of the percent of total IP samples account for by the
particular load module and those listed above it.
•IP Samples: Total number of IP samples attributed to the particular load module.
14
Function Summary:
•% Total IP Samples: Percent of the total IP samples attributable to a particular function.
•Cumulat % of Total: Running sum of the percent of total IP samples account for by the
particular function and those listed above it.
•IP Samples: Total number of IP samples attributed to the particular function.
15
Function Details:
•% Total IP Samples: Percent of the total IP samples attributable to a particular function.
•IP Samples: Total number of IP samples attributed to the particular function.
24Getting Started with the HP Caliper Command-Line Interface
•Line | Slot | Col,Offset
The column contains one of these:
◦A source-code line number for rows showing statements
◦An instruction slot number for rows showing instructions not on a bundle boundary
◦A source-code column number followed by an offset from the beginning address
of a function for rows showing instructions on a bundle boundary
•>Statement | Instruction: The column contains either a source statement, preceded by
“>”, or a disassembled instruction. Statements that are out of order due to optimization
are preceded by “*>”.
16
“File not found” error: Here, the application called a routine in libc, but the source code
for that library routine is not available. This is a common error and you can usually ignore
it.
Example: Adding Instructions to an fprof Report
Notice that, by default, only source statements were shown in the Function Details section. If you
would also like to see disassembled instructions, then you can re-report the collected data using
the -r option. The -r option takes one of the following qualifiers: statement (report source
statements), instruction (report disassembled instructions), or all (report both source and
instructions).
HP Caliper saves the latest collected data and uses that by default when generating a report. It
does not re-run the application and collect new data.
We will also specify an output file using the -o option:
$ caliper fprof -o out.txt -r all
In the resulting report output file (out.txt), you will find an fprof report that shows IP sample
counts down to the instruction level. “fprof Measurement Report for matmul, with IP Sample Counts
for One Function” (p. 26) shows a section of the report that contains IP sample counts for one
function.
The numbers (which are bold in the PDF version of this guide) are annotations to explain the
report—they are not part of the output you receive. See the list at the end of the report for the
explanations.
Example: Adding Instructions to an fprof Report25
Figure 3 fprof Measurement Report for matmul, with IP Sample Counts for One Function
Function Details
--------------------------------------------------% Total Line|
IP IP Slot| >Statement|
Samples Samples Col,Offset Instruction
3.04 [libc.so.1::rand, 0x4119f60, rand.c]
40 ~57 Function Totals
------------------------------------------
1
2
1
Identifies the function (main) for which disassembly is shown. Specifies the function's load
module (matmul), starting address (0x40009a0), and source file (matmul.c.
2
Shows total IP sample hits (1275) and starting line number (38) for the function. A tilde (~)
preceding a line number (~38) indicates that the line number is approximate due to
optimization.
3
Names the source file of function main.
4
Shows sample IP hits (41) for statement at line 16 (~ indicates the line number is approximate
due to optimization) of matmul.c. Sample IP hits for statements are shown in parentheses;
sample IP hits for instructions are not.
Source lines are preceded by >. If a source line is out of order or is associated with multiple,
noncontiguous instructions, the source line is also preceded by an asterisk (*>).
5
Shows sample IP hits (4) for the instruction bundle starting at function offset 0x0290, where
the associated source column is ~9 (~ indicates the source column is approximate due to
optimization). Instructions are preceded by template information: in this case, M for slot 0 and
slot 1, and F_ for slot 2.
6
Shows a discontinuity marker, which indicates that some instruction bundles without associated
data have been left out of the report. (To report all disassembly, use the --context-lines
option.)
26Getting Started with the HP Caliper Command-Line Interface
Types of Measurements
HP Caliper is capable of three types of performance measurement:
•A global measurement of total run metrics
•A sampled measurement based on the granularity you specify
•A precise measurement of every execution path in your code (HP-UX only)
See Table 1 (page 44).
Global Measurement
A global measurement gives you a single value for a specific metric of your program, such as total
CPU time used.
The only global measurement available in HP Caliper is ecount (total CPU time).
A global measurement is best used for:
•Comparing the effect of different types of test data that your program processes
•Comparing the benefits of different compile-time optimization settings
•Detecting performance regressions caused by program modifications
You can use a global measurement to help you identify what performance areas of your program
to investigate further.
The advantage of a global measurement is that it does not affect your program's performance.
The disadvantage of a global measurements is that it does not identify specific parts of your program
that might benefit from optimization.
Sampled Measurements
A sampled measurement measures your program's performance at regular intervals, based on
CPU events, recording the current program location and selected performance metrics.
A sampled measurement is best used for:
•Identifying where your program is spending time
•Identifying approximately where events such as cache misses occur
•Determining the performance effect and location of branch mispredictions
You can use sampled measurements to focus your analysis on specific parts of your program.
The advantage of sampled measurements is that they can help you localize performance issues in
your program.
The disadvantage is that they might miss very fast, seldom-called code. You might need to adjust
HP Caliper settings, such as the sampling frequency, to help locate events in your code.
Sampled measurements also require more resources, such as system memory, which might affect
the run-time performance of your program or limit the amount of information you can collect.
You can control the tradeoff between resource usage and accuracy of the results by changing the
sample interval.
Precise Measurements
A precise measurement gives you exact information about what is happening and where events
are happening in your program. When you use a precise measurement, HP Caliper dynamically
instruments your binary program while it is running to enable the collection of information.
Types of Measurements27
Precise measurements are best used for:
•Identifying the most and least used functions in your program
•Identifying all the branch paths executed in the program
Collecting precise measurements requires more system resources than sampled measurements.
Collecting precise measurements also affects the performance of the program being measured.
The performance effects may vary from a few percent to 300 percent, depending on how much
measurement you request. These performance effects mean that programs making assumptions
about the running time of their code might behave differently when run under HP Caliper.
What to Look for in Using HP Caliper
A useful approach for tuning performance is to start with easy-to-perform global measurements to
identify likely areas for tuning. Then you can use more specific measurements on areas of concern.
For example, you might start by making global measurements on a variety of events, such as:
•CPU cycles
•Instruction execution counts
•Data cache misses
•Instruction cache misses
•Branch mispredictions
The results of the global measurements will quickly identify which factors most affect your program's
performance.
The next step is to make sampled measurements on the top performance factors you have identified.
You can vary the sample rates to find the approximate location of the problem or problems. Usually,
this is sufficient to locate trouble spots.
You can also focus on hot spots. A hot spot is an instruction or set of instructions that has a higher
execution count than most other instructions in a program. For example, code that is inside a loop
will likely be executed more times than straight-line code. Usually the “hotness” is measured with
CPU cycles, but it could also be measured with metrics such as cache misses.
When tuning performance, you first focus on hot spots because a small change in a hot spot,
multiplied by its higher execution frequency, produces a larger improvement than making the same
change in an instruction that is rarely executed.
Here are some useful things to look for in a report:
•If the percent of cycles lost due to stalls (in the Metrics Summed for Entire Run) is high—greater
than 50 percent—the program's performance could probably be improved.
•Although the values in the IP Samples column of the Function Details do not represent actual
execution counts, you can still use the values as a relative ranking of how often particular lines
are executed. The IP Samples values will vary slightly with each run, but they can help you
identify which parts of your code have the most effect on your application's performance.
Syntax for caliper Command
The basic command-line syntax for making measurements with HP Caliper is:
caliper measurement [caliper_options] program [program_arguments]
where:
measurementThe name of a measurement that contains information about what you
want HP Caliper to measure and report.
For more information, see “HP Caliper Measurement Configuration
Files” (p. 43).
28Getting Started with the HP Caliper Command-Line Interface
caliper_optionsParameters used to customize the performance analysis.
For more information, see “HP Caliper Options” (p. 48).
programThe name of the executable program you want HP Caliper to measure.
program_argumentsAny number of arguments expected by your executable.
You can use an options file to specify command-line information, including the measurement,
options, program, and program arguments. See “-f or --options-file” (p. 50) for details.
For more information, see “Configuring HP Caliper ” (p. 92).
Basic Tasks: A Quick Reference
Here is a list of basic tasks and the HP Caliper commands you can use to perform them.
Starting HP Caliper
Once installed, the easiest way to access HP Caliper is to type caliper. For example:
$ caliper myprog
This runs the default measurement, scgprof, on your program in your current directory and
produces a text report to stdout. To run another measurement, just type it:
$ caliper fcount myprog
Stopping HP Caliper
To stop HP Caliper before it finishes measuring your program, enter Ctrl-C, or from another
process use this command:
$ kill -s INT caliper_process_ID
Either of these methods stops the measurement run. HP Caliper then processes the data collected
up to the point where it was stopped and generates a report. There could be a significant delay
before the HP Caliper process terminates.
To stop HP Caliper immediately, without generating data, use this command:
$ kill -s TERM caliper_process_ID
CAUTION:If HP Caliper is measuring processes using instrumentation on HP-UX (that is, generating
a precise measurement), stopping HP Caliper will cause it to forcibly terminate all processes that
are being measured. Any resources used by the processes, such as shared memory segments,
temporary files, and so forth, will not be cleaned up.
For PMU-only measurements, HP Caliper will simply detach from the processes and stop. The
processes will continue normally.
Showing HP Caliper Options
For HP Caliper short help, including a list of the most commonly used options and measurements,
use:
$ caliper -h
For HP Caliper long help, use:
$ caliper -H
Creating a Call Graph Profile with HP Caliper
To create a call graph profile with HP Caliper, use either of these commands:
$ caliper scgprof [caliper_options] program [program_arguments]
or
$ caliper cgprof [caliper_options] program [program_arguments]
Basic Tasks: A Quick Reference29
The first command produces a call graph by sampling. The second command (on HP-UX only)
produces an exact call graph. They both produce an enhanced gprof-like output.
Creating a Text Report for Analysis
To save the report produced by HP Caliper to a file, specify an output file name:
$ caliper measurement -o filename [caliper_options] program [program_arguments]
Creating a Report Based on Your Collected Data
By default, HP Caliper saves the results of a measurement to a database. This allows you to generate
reports with different settings without having to re-run your application.
To create reports based on the database, specify the caliper report command and the report
options you want to use. For example, the following command creates a report based on the last
database you created:
$ caliper report [caliper_report_options]
For more information, see “How HP Caliper Saves Data in Databases” (p. 115).
Using the HP Caliper Advisor
One way to get started using HP Caliper quickly is to use the HP Caliper Advisor. See “Using the
HP Caliper Advisor” (p. 77).
Restrictions on Using HP Caliper
Some restrictions are:
•When HP Caliper detaches from a process, it can affect the I/O relationship between the user
and that process. An example is an application that reads stdin from the user; e.g., caliper
ecount top If HP Caliper is sent a SIGINT (or the --duration option is given), it will
detach from the 'top' process, which will break the I/O between the user and 'top'. Text typed
into the terminal window will no longer be sent to the 'top' process, and the curses library
used by 'top' will break the stty settings in the terminal window.
•Shared library support does not include instrumented measurements ( cgprof, and fcount
measurements) of the dld.so and uld.so system libraries.
•It is not possible to debug an application while it is being measured by HP Caliper.
•These measurements measure and report only aggregated results of multithreaded programs:
ecount•
•fcount
•fcover
•HP Caliper only measures native Integrity servers programs, not PA-RISC programs running
in emulation mode.
•HP Caliper might not be able to measure handwritten assembly code that performs address
arithmetic or does not follow the standard run-time conventions.
•HP Caliper cannot make measurements for dynamically generated code with these
measurements:
•cgprof
•fcount
•fcover
30Getting Started with the HP Caliper Command-Line Interface
Loading...
+ 247 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.