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:

 

measurement

The 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. 42).

What to Look for in Using HP Caliper 27