введение в Performance Co-Pilot (PCP) (introduction to the Performance Co-Pilot (PCP))
PERFORMANCE METRICS - IDENTIFIERS, NAMES, VALUES
The number of performance metric names supported by PCP on most
platforms ranges from many hundreds to several thousand. The PCP
libraries and applications use an internal identification scheme
that unambiguously associates a single integer with each known
performance metric. This integer is known as the Performance
Metric Identifier, or PMID. Although not a requirement, PMIDs
tend to have global consistency across all systems, so a
particular performance metric usually has the same PMID.
For all users and most applications, direct use of the PMIDs
would be inappropriate (this would limit the range of accessible
metrics, make the code hard to maintain, force the user interface
to be particularly baroque, and so on). Hence a Performance
Metrics Name Space (PMNS) is used to provide external names and a
hierarchic classification for performance metrics. A PMNS is
represented as a tree, with each node having a label, a pointer
to either a PMID (for leaf nodes) or a set of descendent nodes in
the PMNS (for non-leaf nodes).
A node label must begin with an alphabetic character, followed by
zero or more characters drawn from the alphabetics, the digits
and character ``_'' (underscore). For alphabetic characters in a
node label, upper and lower case are distinguished.
By convention, the name of a performance metric is constructed by
concatenation of the node labels on a path through the PMNS from
the root node to a leaf node, with a ``.'' as a separator. The
root node in the PMNS is unlabeled, so all names begin with the
label associated with one of the descendent nodes below the root
node of the PMNS, for example kernel.percpu.syscall. Typically
(although this is not a requirement) there would be at most one
name for each PMID in a PMNS. For example kernel.all.cpu.idle
and disk.dev.read are the unique names for two distinct
performance metrics, each with a unique PMID.
Groups of related PMIDs may be named by naming a non-leaf node in
the PMNS tree, for example disk.
The default local PMNS used by pmcd
is located at
$PCP_VAR_DIR/pmns/root
however the environment variable
PMNS_DEFAULT
may be set to the full pathname of a different PMNS
which will then be used as the default local PMNS.
Most applications do not use the local PMNS directly, but rather
import parts of the PMNS as required from the same place that
performance metrics are fetched, i.e. from pmcd(1) for live
monitoring or from a set of PCP archives for retrospective
monitoring.
To explore the PMNS use pminfo(1), or if the PCP GUI package is
installed the New Chart and Metric Search windows within
pmchart(1).
Some performance metrics have a singular value. For example, the
available memory or number of context switches have one value per
performance metric source, that is, one value per host. The
metric descriptor (metadata) for each metric makes this fact
known to applications that process values for these single-valued
metrics.
Some performance metrics have a set of values or instances in
each implementing performance metric domain. For example, one
value for each disk, one value for each process, one value for
each CPU, or one value for each activation of a given
application. When a metric has multiple instances, the PMNS does
not represent this in metric names; rather, a single metric may
have an associated set of values. Multiple values are associated
with the members of an instance domain, such that each instance
has a unique instance identifier within the associated instance
domain. For example, the ''per CPU´´ instance domain may use the
instance identifiers 0, 1, 2, 3, and so on to identify the
configured processors in the system. Internally, instance
identifiers are encoded as binary values, but each performance
metric domain also supports corresponding strings as external
names for the instance identifiers, and these names are used at
the user interface to the PCP utilities.
Multiple performance metrics may be associated with a single
instance domain. For example, per-process metrics under proc all
share the same instance domain.
PCP arranges for information describing instance domains to be
exported from the performance metric domains to the applications
that require this information. Applications may also choose to
retrieve values for all instances of a performance metric, or
some arbitrary subset of the available instances.
Metric names and the instance domain concept provides two-
dimensions for the modelling of performance metrics. This is a
clear and simple model, however on some occasions it does not
suffice. For example, a metric may wish to represent higher
dimensional data such as ``per CPU'' counters for each running
process. In these cases it is common to create a compound
instance, where the name is composed of each component with a
separator in-between (for example, ``87245::cpu7'' might be used
to separate process ID from CPU ID) to create flattened instance
names. Additionally, such cases benefit from the use of metric
instances labels to explicitly show the separate components
(continuing the example from above, labels
``{"pid":87245,"cpu":7}'' might be used).