HP Caliper Advisor Rule Writer Guide
Examples of the Use of the Global Metrics Accessor Functions
• metrics = object.get_metrics(‘IA64_INST_RETIRED’,
‘NOPS_RETIRED’, ‘CPU_CYCLES’, ‘BACK_END_BUBBLE.ALL’)
metrics: (124935886799, 30681829351, 64202559764, 25948247862)
This example retrieves a matched set of four total PMU count metrics, all measured
with a privilege level mask of USER and a threshold of 0. If they all exist in a single
dataset, then a tuple is returned with four integer elements containing the metric
values in the order requested from the first matching dataset.
• metrics = object.get_metrics((‘CPU_CYCLES’, ‘KERNEL’),
(‘IA64_INST_RETIRED’, ‘KERNEL’), ‘n’)
metrics: (420255976, 24935886799, 2)
This example retrieves two total PMU count metrics and the special n metric. For
the call to be successful, both PMU metrics must have been measured with a
privilege level mask of KERNEL and a threshold of 0. If they both exist in a single
dataset, then a tuple is returned with three integer elements. The first two contain
the PMU metric values and the third one is the ID number of the first matching
dataset.
• metrics = object.get_metrics_nth(‘CPU_CYCLES’, -2)
metrics: (64152976405)
This example retrieves a single total PMU count metric from the second dataset
found that contains the requested metric. For the call to be successful, at least two
datasets must contain this metric, measured with a privilege level of USER and a
threshold of 0. If that is true, then the CPU_CYCLES metric data is returned from
the second matching dataset as a 1-element tuple.
• metrics = object.get_metrics(‘STALL.SAMPLE_COUNT’,
‘STALL.RAW_CPI.MEAN’, ‘STALL.RSE_ACTIVE.MAXIMUM’)
metrics: (312, 0.51812832, 0.04873353)
This example retrieves two multiplexed PMU statistics and one of the sampling
parameters from a CPU Metrics measurement run using the stall event set. If
at least one dataset contains performance data from such a run, then a 3-element
tuple is returned containing the number of samples taken, the mean of the
RAW_CPI metric, and the maximum of the RSE_ACTIVE metric (in that order)
from the first matching dataset.
• metrics = object.get_metrics(‘IA64_INST_RETIRED’,
‘L1D_READ_MISSES.ALL’)
metrics: None
This example shows what happens when an accessor function cannot find a single
dataset with all of the requested metrics. A dataset might exist that contains
Global Metrics Accessor Function: get_metrics 41