NAME
pmNameAll, pmRequestNameAll, pmReceiveNameAll - translate a PMID to a
set of performance metric names
C SYNOPSIS
#include <pcp/pmapi.h>
int pmNameAll(pmID pmid, char ***nameset)
int pmRequestNameAll(int ctx, pmID pmid)
int pmReceiveNameAll(int ctx, char ***nameset)
cc ... -lpcp
DESCRIPTION
Given a Performance Metric ID (PMID) via pmid, pmNameAll will determine
all the corresponding metric names, if any, in the Performance Metrics
Name Space (PMNS), and return these via nameset.
The resulting list of pointers nameset and the values (the relative
names) that the pointers reference will have been allocated by
pmNameAll with a single call to malloc(3C), and it is the
responsibility of the pmNameAll caller to free(nameset) to release the
space when it is no longer required.
In the absence of errors, pmNameAll returns the number of names in
nameset.
For many examples of a PMNS, there will be a 1:1 mapping between a name
and a PMID, and under these circumstances, pmNameID(3) provides a
slightly simpler interface in the absence of duplicate names for a
particular PMID.
pmRequestNameAll and pmReceiveNameAll are used by applications which
must communicate with the PMCD asynchronously. These functions take
explict context handle ctx which must refer to a host context (i.e.
created by passing PM_CONTEXT_HOST to pmNewContext). pmRequestNameAll
sends request to PMCD to return names of all metrics matching a PMID
and returns without waiting for the response, pmReceiveNameAll reads
reply from PMCD. It is the responsibility of the application to make
sure the data are ready before calling pmReceiveNameAll to avoid
blocking.
SEE ALSO
PMAPI(3), pmGetChildren(3), pmGetChildrenStatus(3), pmGetConfig(3),
pmLoadASCIINameSpace(3), pmLoadNameSpace(3), pmLookupName(3),
pmNameID(3), pmNewContext(3), pcp.conf(4), pcp.env(4) and pmns(4).
DIAGNOSTICS
PM_ERR_NOPMNS
Failed to access a PMNS for operation. Note that if the
application hasn’t a priori called pmLoadNameSpace(3) and wants
to use the distributed PMNS, then a call to pmNameAll must be
made after the creation of a context (see pmNewContext(3)).
PM_ERR_PMID
pmid does not correspond to a defined PMID in the PMNS.
PM_ERR_*
Other diagnostics are for protocol failures when accessing the
distributed PMNS.
PM_ERR_CTXBUSY
Context is currently in use by another asynchronous call.