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.

3.Use the command-line option --user-regionsrum-sum. (Or place user_regions="rum-sum"in a measurement configuration file.)

This option causes HP Caliper to allow the measured applications to control the PMU. When you specify --user-regionsrum-sum, the PMU is initially disabled, and HP Caliper will not measure the application until the first CALIPER_PMU_ENABLE() is executed.

The default behavior is to disallow such control and measure the full run (--user-regions default).

To override the HP Caliper PMU macros, use --user-regions default on the command line. (Or place user_regions="default" in a measurement configuration file.)

If you do not specify the --user-regionsoption, CALIPER_PMU_ENABLE() and

CALIPER_PMU_DISABLE() do not have any effect and the instructions behave as no-ops.

When the PMU is programmed to allow control by non-privileged instructions, the instruction sum 0x4 enables the PMU, while rum 0x4 disables it. The file include/caliper_control.h in the HP Caliper home directory contains C/C++ macros to inline the rum 0x4 and sum 0x4 instructions.

Figure 32 (page 165) shows how to use the header file and macros.

164 HP Caliper Features Specific to HP-UX

Page 164
Image 164
HP UX IPFilter Software manual Caliperpmuenable