HP Caliper 5.3 User Guide (5900-1558, February 2011)

sampling_counter = NO_EVENT
If you don't change this setting, then the samples you have marked will be included with
whatever sampling results HP Caliper is set to generate.
You can instead run HP Caliper, specifying -s ,,NO_EVENT or -s "" on the command
line.
5. Run your application under HP Caliper using that modified measurement configuration file:
$ caliper my_pmu_trace myprogram
Figure 31 (page 160) shows part of the resulting report.
Figure 31 Example of PMU Trace Report
PMU Trace Buffer 1, Kernel Thread Id 2218765, Samples 1 - 170
[IIR:IA64_INST_RETIRED, NR: NOPS_RETIRED, CC: CPU_CYCLES]
----------------------------------------------------------------------------------
--CPU Event-- --CPU Event-- -CPU Event-- ------IP Samples------
Sample IIR NR CC Bundle Address Sample
Number Count Count Count (module:function) Origin
----------------------------------------------------------------------------------
1 1996102 357759 2030895 0x4001230 TRG(0x1)
(divmod::main)
2 73 10 241 0x4001300 TRG(0x2)
(divmod::main)
3 4 2 22 0x4001230 TRG(0x1)
(divmod::main)
4 73 10 103 0x4001300 TRG(0x2)
(divmod::main)
[...]
The report shows that 1.9 M instructions retired before HP Caliper took the first sample. The first
sample, indicated by TRG(0x1) in the Sample Origin column, was “TRiGgered” by a break
instruction generated by the CALIPER_PMU_TAKE_SAMPLE_1() macro.
The second sample was triggered when the processor executed the
CALIPER_PMU_TAKE_SAMPLE_2() macro. Between those two statements, 73 instructions retired,
among which were 10 nop instructions, taking 241 cycles.
The third and fourth samples show the same sequence. The report shows that on the second
execution the same instructions were executed, but only took 103 cycles. The code executed
between the end and the beginning of that particular loop body took about 22 cycles.
Precautions When Using Triggered Samples
Keep these points in mind:
Generating a large number of triggered samples might result in HP Caliper losing samples.
A rule of thumb to avoid losing samples is to limit either of these:
Total number of such samples to be on the order of hundreds
Rate of sampling to an order of hundreds or thousands of samples per second
Remove the trigger macros in performance-critical regions of code in production executables.
The macros CALIPER_PMU_TAKE_SAMPLE_n() expand to generate inline assembly
instructions, specifically _Asm_break.
While executing those instructions will not cause an application to crash in the absence of HP
Caliper, they will still have an impact on performance. Executing a break instruction causes
a trap to the breakpoint handler in the kernel.
The presence of trigger macros may disable some optimization that the compiler could perform.
The trigger instructions are defined so that code will not be moved around them. This is done
to ensure that code seen in the source between two sample points will not executed before or
after those samples are taken.
160 HP Caliper Features Specific to HP-UX