1PMATOMSTR(3) Library Functions Manual PMATOMSTR(3)
2
3
4
6 pmAtomStr, pmAtomStr_r - convert a performance metric value into a
7 string
8
10 #include <pcp/pmapi.h>
11
12 const char *pmAtomStr(const pmAtomValue *avp, int type);
13 char *pmAtomStr_r(const pmAtomValue *avp, int type, char *buf, int bu‐
14 flen);
15
16 cc ... -lpcp
17
19 All performance metric values may be encoded in a pmAtomValue union,
20 defined as follows;
21
22 typedef union {
23 __int32_t l; /* 32-bit signed */
24 __uint32_t ul; /* 32-bit unsigned */
25 __int64_t ll; /* 64-bit signed */
26 __uint64_t ull; /* 64-bit unsigned */
27 float f; /* 32-bit floating point */
28 double d; /* 64-bit floating point */
29 char *cp; /* char ptr */
30 pmValueBlock *vbp; /* pmValueBlock ptr */
31 } pmAtomValue;
32
33 Given the performance metric value pointed to by avp, and a performance
34 metric type defined by type, pmAtomStr will generate the corresponding
35 metric value as a string, suitable for diagnostic or report output.
36 The pmAtomStr_r function does the same, but stores the result in a
37 user-supplied buffer buf of length buflen, which should have room for
38 at least 80 bytes.
39
40 The value for type is typically extracted from a pmDesc structure, fol‐
41 lowing a call to pmLookupDesc(3) for a particular performance metric.
42
43 If the type is PM_TYPE_STRING values longer than 38 characters will be
44 truncated after 34 characters, and truncation shown with ellipsis
45 ``...'' at the end of the value.
46
47 If the type is PM_TYPE_AGGREGATE then up to the first three 32-bit
48 words are displayed as hexadecimal values.
49
50 If the type is PM_TYPE_EVENT then a summary of the number of event
51 records found in the value is generated.
52
53 The return value from pmAtomStr is held in a single static buffer, so
54 the returned value is only valid until the next call to pmAtomStr.
55
57 pmAtomStr returns a pointer to a static buffer and hence is not thread-
58 safe. Multi-threaded applications should use pmAtomStr_r instead.
59
61 PMAPI(3), pmConvScale(3), pmExtractValue(3), pmLookupDesc(3), pmPrint‐
62 Value(3), pmTypeStr(3) and pmUnitsStr(3).
63
64
65
66Performance Co-Pilot PCP PMATOMSTR(3)