pmLookupDesc(3) — Linux manual page


PMLOOKUPDESC(3)           Library Functions Manual           PMLOOKUPDESC(3)

NAME         top

       pmLookupDesc - obtain a description for a performance metric

C SYNOPSIS         top

       #include <pcp/pmapi.h>

       int pmLookupDesc(pmID pmid, pmDesc *desc);

       cc ... -lpcp

DESCRIPTION         top

       Given a Performance Metrics Identifier (PMID) as pmid, fill in the
       given pmDesc structure, pointed to by the parameter desc, from the
       current Performance Metrics Application Programming Interface (PMAPI)

       The pmDesc structure provides all of the information required to
       describe and manipulate a performance metric via the PMAPI, and has
       the following declaration.

            /* Performance Metric Descriptor */
            typedef struct {
                pmID    pmid;   /* unique identifier */
                int     type;   /* base data type (see below) */
                pmInDom indom;  /* instance domain */
                int     sem;    /* semantics of value (see below) *
                pmUnits units;  /* dimension and units (see below) */
            } pmDesc;

            /* pmDesc.type -- data type of metric values */
            #define PM_TYPE_NOSUPPORT        -1    /* not impl. in this version */
            #define PM_TYPE_32               0    /* 32-bit signed integer */
            #define PM_TYPE_U32              1    /* 32-bit unsigned integer */
            #define PM_TYPE_64               2    /* 64-bit signed integer */
            #define PM_TYPE_U64              3    /* 64-bit unsigned integer */
            #define PM_TYPE_FLOAT            4    /* 32-bit floating point */
            #define PM_TYPE_DOUBLE           5    /* 64-bit floating point */
            #define PM_TYPE_STRING           6    /* array of char */
            #define PM_TYPE_AGGREGATE        7    /* arbitrary binary data */
            #define PM_TYPE_AGGREGATE_STATIC 8    /* static pointer to aggregate */
            #define PM_TYPE_EVENT            9    /* packed pmEventArray */
            #define PM_TYPE_UNKNOWN          255  /* used in pmValueBlock, not pmDesc */

            /* pmDesc.sem -- semantics/interpretation of metric values */
            #define PM_SEM_COUNTER  1  /* cumulative ctr (monotonic incr) */
            #define PM_SEM_INSTANT  3  /* instant. value continuous domain */
            #define PM_SEM_DISCRETE 4  /* instant. value discrete domain */

       The type field in the pmDesc describes various encodings (or formats)
       for a metric's value.

       If a value is counted in the underlying base instrumentation with
       less than 32 bits of integer precision, it is the responsibility of
       the Performance Metrics Domain Agent (PMDA) to promote the value to a
       32-bit integer before it is exported into the Performance Metrics
       Collection Subsystem (PMCS); i.e. applications above the PMAPI never
       have to deal with 8-bit and 16-bit counters.

       If the value of a performance metric is of type PM_TYPE_AGGREGATE,
       interpretation of the value is unknown to the PMCS.  In these cases,
       the application using the value, and the PMDA providing the value
       must have some common understanding about how the value is structured
       and interpreted.

       Each value for a performance metric is assumed to be drawn from a set
       of values that can be described in terms of their dimensionality and
       scale by a compact encoding as follows.  The dimensionality is
       defined by a power, or index, in each of 3 orthogonal dimensions,
       namely Space, Time and Count (or Events, which are dimensionless).
       For example I/O throughput might be represented as
       while the running total of system calls is Count, memory allocation
       is Space and average service time is
       In each dimension there are a number of common scale values that may
       be used to better encode ranges that might otherwise exhaust the
       precision of a 32-bit value.  This information is encoded in the
       pmUnits structure which is embedded in the pmDesc structure.

             * Encoding for the units (dimensions Time and Space) and scale
             * for Performance Metric Values
             * For example, a pmUnits struct of
             *      { 1, -1, 0, PM_SPACE_MBYTE, PM_TIME_SEC, 0 }
             * represents Mbytes/sec, while
             *      { 0, 1, -1, 0, PM_TIME_HOUR, 6 }
             * represents hours/million-events
            typedef struct {
                int dimSpace:4;             /* space dimension */
                int dimTime:4;              /* time dimension */
                int dimCount:4;             /* event dimension */
                unsigned int scaleSpace:4;  /* one of PM_SPACE_* below */
                unsigned int scaleTime:4;   /* one of PM_TIME_* below */
                int scaleCount:4;           /* one of PM_COUNT_* below */
            } pmUnits;                      /* dimensional units and scale of value */

            /* pmUnits.scaleSpace */
            #define PM_SPACE_BYTE   0       /* bytes */
            #define PM_SPACE_KBYTE  1       /* Kilobytes (1024) */
            #define PM_SPACE_MBYTE  2       /* Megabytes (1024^2) */
            #define PM_SPACE_GBYTE  3       /* Gigabytes (1024^3) */
            #define PM_SPACE_TBYTE  4       /* Terabytes (1024^4) */
            /* pmUnits.scaleTime */
            #define PM_TIME_NSEC    0       /* nanoseconds */
            #define PM_TIME_USEC    1       /* microseconds */
            #define PM_TIME_MSEC    2       /* milliseconds */
            #define PM_TIME_SEC     3       /* seconds */
            #define PM_TIME_MIN     4       /* minutes */
            #define PM_TIME_HOUR    5       /* hours */
             * pmUnits.scaleCount (e.g. count events, syscalls, interrupts,
             * etc.) these are simply powers of 10, and not enumerated here,
             * e.g. 6 for 10^6, or -3 for 10^-3
            #define PM_COUNT_ONE    0       /* 1 */

       Special routines (e.g. pmExtractValue(3), pmConvScale(3)) are
       provided to manipulate values in conjunction with the pmUnits
       structure that defines the dimension and scale of the values for a
       particular performance metric.

       Below the PMAPI, the information required to complete the pmDesc
       structure, is fetched from the PMDAs, and in this way the format and
       scale of performance metrics may change dynamically, as the PMDAs and
       their underlying instrumentation evolve with time.  In particular,
       when some metrics suddenly become 64-bits long, or change their units
       from Mbytes to Gbytes, well-written applications using the services
       provided by the PMAPI will continue to function correctly.

SEE ALSO         top

       PMAPI(3), pmAtomStr(3), pmConvScale(3), pmExtractValue(3),
       pmGetConfig(3), pmTypeStr(3), pmUnitsStr(3), pcp.conf(5) and

DIAGNOSTICS         top

              The requested PMID is not known to the PMCS

              The PMDA responsible for providing the metric is currently not

COLOPHON         top

       This page is part of the PCP (Performance Co-Pilot) project.
       Information about the project can be found at ⟨⟩.
       If you have a bug report for this manual page, send it to  This page was obtained from the project's upstream
       Git repository ⟨⟩ on
       2020-11-01.  (At that time, the date of the most recent commit that
       was found in the repository was 2020-10-30.)  If you discover any
       rendering problems in this HTML version of the page, or you believe
       there is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to

Performance Co-Pilot                 PCP                     PMLOOKUPDESC(3)

Pages that refer to this page: pmdaopenmetrics(1)pmdumplog(1)pmgenmap(1)pmie(1)pmlogcheck(1)pmlogrewrite(1)pmseries(1)sheet2pcp(1)pmaddprofile(3)pmAddProfile(3)pmapi(3)PMAPI(3)pmatomstr(3)pmAtomStr(3)pmAtomStr_r(3)pmconvscale(3)pmConvScale(3)pmda(3)PMDA(3)pmdadesc(3)pmdaDesc(3)pmdaExtGetData(3)pmdaExtSetData(3)pmdaExtSetFlags(3)pmdainit(3)pmdaInit(3)pmdaRehash(3)pmdaSetCommFlags(3)pmdaSetData(3)pmdaSetFlags(3)pmdelprofile(3)pmDelProfile(3)pmextractvalue(3)pmExtractValue(3)pmfetch(3)pmFetch(3)pmGetClusterLabels(3)pmGetContextLabels(3)pmgetderivedcontrol(3)pmGetDerivedControl(3)pmGetDomainLabels(3)pmgetindom(3)pmGetInDom(3)pmgetindomarchive(3)pmGetInDomArchive(3)pmGetInDomLabels(3)pmGetInstancesLabels(3)pmGetItemLabels(3)pmiaddmetric(3)pmiAddMetric(3)pmidstr(3)pmIDStr(3)pmIDStr_r(3)pmiID(3)pmiInDom(3)pmindomstr(3)pmInDomStr(3)pmInDomStr_r(3)pmiunits(3)pmiUnits(3)pmlookupindom(3)pmLookupInDom(3)pmlookupindomarchive(3)pmLookupInDomArchive(3)pmlookupindomtext(3)pmLookupInDomText(3)pmlookuplabels(3)pmLookupLabels(3)pmlookuptext(3)pmLookupText(3)pmnameindom(3)pmNameInDom(3)pmnameindomarchive(3)pmNameInDomArchive(3)pmparseunitsstr(3)pmParseUnitsStr(3)pmprintdesc(3)pmPrintDesc(3)pmprintvalue(3)pmPrintValue(3)pmregisterderived(3)pmRegisterDerived(3)pmRegisterDerivedMetric(3)pmsemstr(3)pmSemStr(3)pmSemStr_r(3)pmSetDerivedControl(3)pmsetmode(3)pmSetMode(3)pmtypestr(3)pmTypeStr(3)pmTypeStr_r(3)pmunitsstr(3)pmUnitsStr(3)pmUnitsStr_r(3)pmwebapi(3)PMWEBAPI(3)qmcdesc(3)QmcDesc(3)logarchive(5)LOGARCHIVE(5)