1PMUNPACKEVENTRECORDS(3) Library Functions Manual PMUNPACKEVENTRECORDS(3)
2
3
4
6 pmUnpackEventRecords - unpack event records
7
9 #include <pcp/pmapi.h>
10
11 int pmUnpackEventRecords(pmValueSet *vsp, int idx, pmResult ***rap);
12
13 int pmUnpackHighResEventRecords(pmValueSet *vsp, int idx, pmHighResRe‐
14 sult ***hrap);
15
16 cc ... -lpcp
17
19 Event records are encoded as a packed array of records within a pmRe‐
20 sult using a container metric with a value of type PM_TYPE_EVENT , and
21 a pmHighResResult when using a metric of type PM_TYPE_HIGHRES_EVENT.
22
23 pmUnpackEventRecords and pmUnpackHighResEventRecords may be used to
24 unpack event records from a metric value identified by vsp and idx. If
25 the metric has a singular value, idx should be 0, else the ordinal
26 instance value identified by idx will be unpacked, i.e.
27 vsp->vlist[idx]. The unpacked records are turned into either pmResult
28 or pmHighResResult structures, one per event record and one metric per
29 event parameter, and rap is returned as a pointer to an array (NULL
30 pointer terminated) of pointers to the result structures.
31
32 The only difference between the two result types is the timestamp
33 scale; the pmHighResResult allows for nanosecond precision, whereas
34 pmResult allows for microsecond resolution.
35
36 Some control information from the packed event records is unpacked into
37 additional ``anonymous'' metrics as follows:
38
39 1. If the event record has a non-zero flags value, then the corre‐
40 sponding pmResult/pmHighResResult will have the flags value encoded
41 with the additional metric event.flags that is inserted ahead of
42 all other event parameters.
43
44 2. If the event record flag is set to PM_EVENT_FLAG_MISSED, then the
45 corresponding pmResult/pmHighResResult will have one metric
46 event.missed with a value that equals the number of event records
47 ``missed'' because either the PMDA could not keep up, or the PMAPI
48 client did not collect the event records fast enough.
49
50 pmUnpackEventRecords returns the number of pmResult structures as the
51 return value, which is >= 0 for success. Similarly, pmUnpackHighResEv‐
52 entRecords returns the number of pmHighResResult structures as the
53 return value, which is >= 0 for success.
54
55 rap and the associated pmResult structures may be freed using the con‐
56 venience function pmFreeEventResult(3).
57
58 Similarly, the hrap and the associated pmHighResResult structures may
59 be freed using the convenience function pmFreeHighResEventResult.
60
62 The following errors are possible:
63
64 PM_ERR_CONV
65 The values associated with vsp are not encoded using the for‐
66 mat PM_VAL_DPTR or PM_VAL_SPTR, or the flags at the head of
67 the event record has an unexpected value.
68
69 PM_ERR_INST
70 The value associated with vsp is not singular as expected.
71
72 PM_ERR_TYPE
73 vsp is not a value of type PM_TYPE_EVENT.
74
75 PM_ERR_TOOSMALL
76 The value identified by vbp is not legal because the value
77 length is less than the minimum size, or the number of event
78 records encoded in the (value header) pmEventArray/pmEven‐
79 tHighResArray structure is negative, or the number of missed
80 event records in the array is negative.
81
82 PM_ERR_TOOBIG
83 Either vsp indicates more than one value is present (all the
84 event records are expected to be packed in a single metric
85 value), or when unpacking the event records, the processing
86 continues past the end of the enclosing value. Indicates
87 corruption of the packed event record.
88
89 PM_ERR_TYPE
90 Event parameters must have one of the arithmetic types, else
91 PM_TYPE_AGGREGATE, PM_TYPE_STRING or PM_TYPE_AGGRE‐
92 GATE_STATIC.
93
94 other values < 0
95 refer to pmErrStr(3).
96
98 PMAPI(3) and pmFreeEventResult(3).
99
100
101
102Performance Co-Pilot PCP PMUNPACKEVENTRECORDS(3)