pmunpackeventrecords(3) — Linux manual page

NAME | C SYNOPSIS | DESCRIPTION | RETURN VALUE | SEE ALSO | COLOPHON

PMUNPACKEVENTRECORDS(3)  Library Functions Manual PMUNPACKEVENTRECORDS(3)

NAME         top

       pmUnpackHighResEventRecords, pmUnpackEventRecords - unpack event
       records

C SYNOPSIS         top

       #include <pcp/pmapi.h>

       int pmUnpackHighResEventRecords(pmValueSet *vsp, int idx,
                                       pmResult ***hrap);
       int pmUnpackEventRecords(pmValueSet *vsp, int idx,
                                pmResult_v2 ***rap);

       cc ... -lpcp

DESCRIPTION         top

       Event  records  are  encoded as a packed array of records within a
       pmResult  using  a  container  metric  with  a   value   of   type
       PM_TYPE_HIGHRES_EVENT and a pmResult_v2 when using a metric with a
       value of type PM_TYPE_EVENT.

       pmUnpackHighResEventRecords  and  pmUnpackEventRecords may be used
       to unpack event records from a metric value identified by vsp  and
       idx.   If  the  metric has a singular value, idx should be 0, else
       the ordinal instance value identified by  idx  will  be  unpacked,
       i.e. vsp->vlist[idx].  The unpacked records are turned into either
       pmResult  or  pmResult_v2 structures, one per event record and one
       metric per event parameter, and hrap  or  rap  is  returned  as  a
       pointer  to  an array (NULL pointer terminated) of pointers to the
       result structures.

       The only difference between the two result types is the  timestamp
       scale; the pmResult allows for nanosecond precision, whereas pmRe‐
       sult_v2 allows for microsecond resolution.

       Some control information from the packed event records is unpacked
       into additional ``anonymous'' metrics as follows:

       1.  If the event record has a non-zero flags value, then the cor‐
           responding pmResult/pmResult_v2 will have the flags value en‐
           coded with the additional metric event.flags that is inserted
           ahead of all other event parameters.

       2.  If the event record flag is set to PM_EVENT_FLAG_MISSED, then
           the corresponding pmResult/pmResult_v2 will have one metric
           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.

       pmUnpackHighResEventRecords returns the number of pmResult struc‐
       tures as the return value, which is >= 0 for success.  Similarly,
       pmUnpackEventRecords returns the number of pmResult_v2 structures
       as the return value, which is >= 0 for success.

       hrap and the associated pmResult structures may be freed using the
       convenience function pmFreeHighResEventResult(3).

       Similarly, rap and the associated pmResult_v2 structures may be
       freed using the convenience function pmFreeEventResult(3).

RETURN VALUE         top

       The following errors are possible:

       PM_ERR_CONV
              The values associated with 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.

       PM_ERR_INST
              The value associated with vsp is not singular as expected.

       PM_ERR_TYPE
              vsp is not a value of type PM_TYPE_HIGHRES_EVENT for
              pmUnpackHighResEventRecords or PM_TYPE_EVENT for pmUnpack‐
              EventRecords.

       PM_ERR_TOOSMALL
              The value identified by vsp is not legal because the value
              length is less than the minimum size, or the number of
              event records encoded in the (value header) pmHighResEven‐
              tArray/pmEventArray structure is negative, or the number of
              missed event records in the array is negative.

       PM_ERR_TOOBIG
              Either 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.

       PM_ERR_TYPE
              Event parameters must have one of the arithmetic types,
              else PM_TYPE_AGGREGATE, PM_TYPE_STRING or PM_TYPE_AGGRE‐
              GATE_STATIC.

       other values < 0
              refer to pmErrStr(3).

SEE ALSO         top

       PMAPI(3) and pmFreeEventResult(3).

COLOPHON         top

       This page is part of the PCP (Performance Co-Pilot) project.  In‐
       formation about the project can be found at ⟨http://www.pcp.io/⟩.
       If you have a bug report for this manual page, send it to
       pcp@groups.io.  This page was obtained from the project's upstream
       Git repository ⟨https://github.com/performancecopilot/pcp.git⟩ on
       2025-08-11.  (At that time, the date of the most recent commit
       that was found in the repository was 2025-08-11.)  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 man-pages@man7.org

Performance Co-Pilot               PCP            PMUNPACKEVENTRECORDS(3)

Pages that refer to this page: pmextractvalue(3)pmfreeeventresult(3)