1PMCONVSCALE(3)             Library Functions Manual             PMCONVSCALE(3)
2
3
4

NAME

6       pmConvScale - rescale a performance metric value
7

C SYNOPSIS

9       #include <pcp/pmapi.h>
10
11       int pmConvScale(int type, const pmAtomValue *ival,
12               const pmUnits *iunit, pmAtomValue *oval, const pmUnits *ounit);
13
14       cc ... -lpcp
15

DESCRIPTION

17       All performance metric values may be encoded in  a  pmAtomValue  union,
18       defined as follows;
19
20            typedef union {
21                __int32_t    l;     /* 32-bit signed */
22                __uint32_t   ul;    /* 32-bit unsigned */
23                __int64_t    ll;    /* 64-bit signed */
24                __uint64_t   ull;   /* 64-bit unsigned */
25                float        f;     /* 32-bit floating point */
26                double       d;     /* 64-bit floating point */
27                char         *cp;   /* char ptr */
28                pmValueBlock *vbp;  /* pmValueBlock ptr */
29            } pmAtomValue;
30
31       The  encoding of a performance metric's dimensionality and scale uses a
32       pmUnits structure; see pmLookupDesc(3).
33
34       Given a performance metric value pointed to by ival multiply  it  by  a
35       scale  factor  and  return  the value in oval.  The scaling takes place
36       from the units defined by iunit into the units defined by ounit.   Both
37       input and output units must have the same dimensionality.
38
39       The  performance metric type for both input and output values is deter‐
40       mined by type, the value for which is typically extracted from a pmDesc
41       structure, following a call to pmLookupDesc(3) for a particular perfor‐
42       mance metric.
43
44       pmConvScale is most useful when values returned  via  pmFetch(3),  (and
45       possibly  extracted using pmExtractValue(3)) need to be normalized into
46       some canonical scale and units for the purposes of computation.
47
48       As a special case, if all components of the dimension  are  zero,  then
49       this is treated as synonymous with a ``count'' dimension of one, and so
50       the ``count'' scale components determine the  relative  scaling.   This
51       accommodates  the  case  where  performance  metrics are dimensionless,
52       without special case handling on the part of the caller.
53

DIAGNOSTICS

55       PM_ERR_CONV
56
57              iunit and ounit have different dimensionality, or have  inappro‐
58              priate type
59
60       PM_ERR_UNIT
61
62              Inappropriate iunit or ounit parameter
63

SEE ALSO

65       PMAPI(3), pmAtomStr(3), pmExtractValue(3), pmFetch(3), pmLookupDesc(3),
66       pmPrintValue(3), pmTypeStr(3) and pmUnitsStr(3).
67
68
69
70Performance Co-Pilot                  PCP                       PMCONVSCALE(3)
Impressum