HP Caliper Advisor Rule Writer Guide
def function_name (parameter_list):
function source statements
...
Include statements cause the contents of the named rule file to be read and compiled.
A rule file can 'include' another file to any nesting depth. Any one rule file is only
processed once. There are two forms of the include statement:
include(“rule_file”) Always include rule_file; fatal error if it
doesn’t exist
include(“rule_file”, True) Always include rule_file; fatal error if it
doesn’t exist
include(“rule_file”, False) Conditionally include rule_file; no error if it
doesn’t exist
Rule files can 'include' other rule files and the infrastructure will ignore duplicate
inclusions of the same file.
All rule functions across all rule files must be uniquely named.
Rule files can be specified with a full or relative path to identify a specific file. If a rule
file is specified by a simple filename, the Advisor will search for it in this order:
1. The current working directory
2. If processing an include statement, the directory containing the rule file that is
doing the include
3. The personal rules directory (~/caliper_advisor/)
4. The HP Caliper rules directory ($CALIPER_HOME/rules/)
This ordering allows users to override HP Caliper rule files with a project rule file or
their own personal rule file.
A suggested way to organize rules is to group them by performance area into separate
rule files, then have a single master rule file that includes the others. Rule functions
can be grouped into files using criteria such as: performance area they deal with (CPU,
memory, I/O, and so forth), application type (CPU-intensive, database, MPI, interactive,
and so forth), advice type (metric, explanation, measurement, improvement), and so
on.
It is also good practice to keep all related rule files together in a single directory and
use only simple filenames in include statements.
The default rule file ($CALIPER_HOME/rules/default) conditionally includes the
my_rules rule file. You can define supplemental Advisor rules in that rule file
(contained in either the working directory or the personal rule directory), which are
used in addition to the standard set of rules.
Analysis Objects: Concepts
An analysis object is the focal point for all rule processing.
30 How the HP Caliper Advisor Works