HP Caliper Advisor Rule Writer Guide

metric1 = object.get_metrics(CPU_CYCLES)
metric2 = object.get_metrics(NOPS_RETIRED)
The first get_metrics() call will always return matched data from the same
measurement run. The last get_metrics() calls might return metric data from
two different measurement runs.
The first call must be used when the metrics are going to be used together in a
derived metric calculation. The last calls should be used when both metrics are
needed but are not going to be combined.
Even highly tuned applications experience a certain level of performance
bottlenecks. Rules should take this into account by not issuing advice unless their
key metric exceeds a minimal threshold. For example, the sample rule above calls
advice() only if the percentage of ITLB misses is greater than 0.5%.
Currently, HP Caliper cannot measure all performance areas, but other tools exist
that can measure some of the uncovered ones. You should include advice about
running a non-Caliper performance tool if performance data indicates that it might
be useful. Be sure to include information about how to run the tool and what to
look for in the results, since the Advisor will not be able to analyze the output.
When testing a rule function, it is often helpful to change the exception handling
to report any exceptions.
An efficient way to test for the presence of a histogram is to use the special n
metric. This does not cause any histogram values to be needlessly retrieved. For
example:
metrics = object.get_histogram(IP, n)
64 Writing Rules for the HP Caliper Advisor