HP Caliper User's Guide

Reasons to use this feature include:
Analyzing a particular loop or function. You can restrict measurements to a
particular loop to get information such as:
ecount Number of events occurring in the loop
fprof Hot spots in the loop
branch Analysis of the loop branches
dcache Data cache misses in the loop
Analyzing a particular phase in an application.
For applications with important startup or shutdown phases, it is sometimes
beneficial to limit measurements to the “in-between” phase. This technique allows
you to use test cases that run for a shorter time, without having to worry about
the effects caused by the startup and shutdown code.
Similarly, the data collection can be restricted to the startup or shutdown phases
to target those for performance improvements.
NOTE: This feature is not intended to measure a small number of instructions.
Enabling and disabling the PMU are not immediate operations and either operation
might take a few processor cycles to be effective. Processor events occurring during
those transitions might or might not be measured. Avoid using measurement windows
so small that those uncertainties will significantly affect the reported numbers.
To use this feature:
1. Modify the program source code to use the header file provided with HP Caliper.
The location of the header file is include/caliper_control.h in the HP
Caliper home directory.
2. In your source code, add the HP Caliper macros to enable and disable the PMU.
To enable the PMU, insert:
CALIPER_PMU_ENABLE();
Using CALIPER_PMU_ENABLE() enables the PMU for the current thread
until the next CALIPER_PMU_DISABLE().
When the PMU is already enabled, CALIPER_PMU_ENABLE() does not have
any effect.
To disable the PMU, insert:
CALIPER_PMU_DISABLE();
When the PMU is already disabled, CALIPER_PMU_DISABLE() does not
have any effect.
212 HP Caliper Features Specific to HP-UX