summaryrefslogtreecommitdiff
path: root/man/man3/pmunpackeventrecords.3
blob: 6f581adbcdee0aa7c8f38cdaf0c7cce5c712a660 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
'\"macro stdmacro
.\"
.\" Copyright (c) 2014 Red Hat.
.\" Copyright (c) 2010 Ken McDonell.  All Rights Reserved.
.\" 
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\" 
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\" 
.\"
.TH PMUNPACKEVENTRECORDS 3 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmUnpackEventRecords\f1 \- unpack event records
.SH "C SYNOPSIS"
.ft 3
#include <pcp/pmapi.h>
.sp
int pmUnpackEventRecords(pmValueSet *\fIvsp\fP, int \fIidx\fP, pmResult ***\fIrap\fP);
.sp
int pmUnpackHighResEventRecords(pmValueSet *\fIvsp\fP, int \fIidx\fP, pmHighResResult ***\fIhrap\fP);
.sp
cc ... \-lpcp
.ft 1
.SH DESCRIPTION
.de CW
.ie t \f(CW\\$1\f1\\$2
.el \fI\\$1\f1\\$2
..
Event records are encoded as a packed array of records within a
.I pmResult
using a container metric with a value of type
.B PM_TYPE_EVENT ,
and a
.I pmHighResResult
when using a metric of type
.BR PM_TYPE_HIGHRES_EVENT .
.PP
.B pmUnpackEventRecords
and
.B pmUnpackHighResEventRecords
may be used to unpack event records from a metric value
identified by
.I vsp
and
.IR idx .
If the metric has a singular value,
.I idx
should be 0, else the ordinal instance value identified by
.I idx
will be unpacked, i.e. vsp->vlist[idx].
The unpacked records are turned into either
.I pmResult
or
.I pmHighResResult
structures, one per event record and one metric per event parameter, and
.I rap
is returned as a pointer to an array (NULL pointer terminated) of
pointers to the result structures.
.PP
The only difference between the two result types is the timestamp scale;
the
.I pmHighResResult
allows for nanosecond precision, whereas
.I pmResult
allows for microsecond resolution.
.PP
Some control information from the packed event records is unpacked
into additional ``anonymous'' metrics as follows:
.TP 4n
1.
If the event record has a non-zero flags value, then the corresponding
.IR pmResult / pmHighResResult
will have the flags value encoded with the additional metric
.B event.flags
that is inserted ahead of all other event parameters.
.TP 4n
2.
If the event record flag is set to
.BR PM_EVENT_FLAG_MISSED ,
then the corresponding
.IR pmResult / pmHighResResult
will have one metric
.B event.missed
with a value that equals the number of event records ``missed'' because
either the PMDA could not keep up, or the PMAPI client did not collect
the event records fast enough.
.PP
.B pmUnpackEventRecords
returns the number of
.I pmResult
structures as the return value, which is >= 0 for success.
Similarly,
.B pmUnpackHighResEventRecords
returns the number of
.I pmHighResResult
structures as the return value, which is >= 0 for success.
.PP
.I rap
and the associated
.I pmResult
structures may be freed using the convenience function
.BR pmFreeEventResult (3).
.PP
Similarly, the
.I hrap
and the associated
.I pmHighResResult
structures may be freed using the convenience function
.BR pmFreeHighResEventResult .
.SH "RETURN VALUE"
The following errors are possible:
.TP 10n
PM_ERR_CONV
The values associated with
.I vsp
are not encoded using the format PM_VAL_DPTR or PM_VAL_SPTR, or
the flags at the head of the event record has an unexpected value.
.TP 10n
PM_ERR_INST
The value associated with
.I vsp
is not singular as expected.
.TP 10n
PM_ERR_TYPE
.I vsp
is not a value of type
.BR PM_TYPE_EVENT .
.TP 10n
PM_ERR_TOOSMALL
The value identified by
.I vbp
is not legal because the value length is less than the minimum size,
or the number of event records encoded in the (value header)
.IR pmEventArray / pmEventHighResArray
structure is negative, or the number of missed event records in the
array is negative.
.TP 10n
PM_ERR_TOOBIG
Either
.B vsp
indicates more than one value is present (all the event records
are expected to be packed in a single metric value), or
when unpacking the event records, the processing continues past the end of
the enclosing value.  Indicates corruption of the packed event record.
.TP 10n
PM_ERR_TYPE
Event parameters must have one of the arithmetic types, else
.BR PM_TYPE_AGGREGATE ,
.B PM_TYPE_STRING
or
.BR PM_TYPE_AGGREGATE_STATIC .
.TP 10n
other values < 0
refer to
.BR pmErrStr (3).
.SH SEE ALSO
.BR PMAPI (3)
and
.BR pmFreeEventResult (3).