pmconvscale(3) — Linux manual page


PMCONVSCALE(3)          Library Functions Manual          PMCONVSCALE(3)

NAME         top

       pmConvScale - rescale a performance metric value

C SYNOPSIS         top

       #include <pcp/pmapi.h>

       int pmConvScale(int type, const pmAtomValue *ival,
               const pmUnits *iunit, pmAtomValue *oval,
               const pmUnits *ounit);

       cc ... -lpcp

DESCRIPTION         top

       All performance metric values may be encoded in a pmAtomValue
       union, defined as follows;

            typedef union {
                __int32_t    l;     /* 32-bit signed */
                __uint32_t   ul;    /* 32-bit unsigned */
                __int64_t    ll;    /* 64-bit signed */
                __uint64_t   ull;   /* 64-bit unsigned */
                float        f;     /* 32-bit floating point */
                double       d;     /* 64-bit floating point */
                char         *cp;   /* char ptr */
                pmValueBlock *vbp;  /* pmValueBlock ptr */
            } pmAtomValue;

       The encoding of a performance metric's dimensionality and scale
       uses a pmUnits structure; see pmLookupDesc(3).

       Given a performance metric value pointed to by ival multiply it
       by a scale factor and return the value in oval.  The scaling
       takes place from the units defined by iunit into the units
       defined by ounit.  Both input and output units must have the same

       The performance metric type for both input and output values is
       determined by type, the value for which is typically extracted
       from a pmDesc structure, following a call to pmLookupDesc(3) for
       a particular performance metric.

       pmConvScale is most useful when values returned via pmFetch(3),
       (and possibly extracted using pmExtractValue(3)) need to be
       normalized into some canonical scale and units for the purposes
       of computation.

       As a special case, if all components of the dimension are zero,
       then this is treated as synonymous with a ``count'' dimension of
       one, and so the ``count'' scale components determine the relative
       scaling.  This accommodates the case where performance metrics
       are dimensionless, without special case handling on the part of
       the caller.

DIAGNOSTICS         top


              iunit and ounit have different dimensionality, or have
              inappropriate type


              Inappropriate iunit or ounit parameter

SEE ALSO         top

       PMAPI(3), pmAtomStr(3), pmExtractValue(3), pmFetch(3),
       pmLookupDesc(3), pmPrintValue(3), pmTypeStr(3) and pmUnitsStr(3).

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 2023-12-22.
       (At that time, the date of the most recent commit that was found
       in the repository was 2023-12-16.)  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                    PMCONVSCALE(3)

Pages that refer to this page: pcpintro(3)pmapi(3)pmatomstr(3)pmextractvalue(3)pmlookupdesc(3)pmparseunitsstr(3)pmprintvalue(3)pmsemstr(3)pmtypestr(3)pmunitsstr(3)