PMUNPACKEVENTRECORDS(3)
π PMUNPACKEVENTRECORDS π
okay bestie, welcome to the Library Functions Manual section of the pcp cinematic universe, where we take event records that are all squished together and set them free. it's giving β¨liberationβ¨
π NAME π
pmUnpackHighResEventRecords, pmUnpackEventRecords β unpack event records. yes queen, that's literally the whole job. two functions, one mission, zero drama π
πΈ C SYNOPSIS πΈ
like here's how you actually call them, copy-paste ready, no notes:
#include <pcp/pmapi.h>
int pmUnpackHighResEventRecords(pmValueSet *vsp, int idx,
pmResult ***hrap);
int pmUnpackEventRecords(pmValueSet *vsp, int idx, pmResult_v2 ***rap);
cc ... -lpcp
don't forget that -lpcp at the end or the linker will simply end you π₯
π¦ DESCRIPTION π¦
so here's the tea π: event records are encoded as a packed array of records inside a pmResult, using a container metric with a value of type PM_TYPE_HIGHRES_EVENT, and a pmResult_v2 when you're using a metric with a value of type PM_TYPE_EVENT.
pmUnpackHighResEventRecords and pmUnpackEventRecords are the two besties you call to unpack those event records out of a metric value that's identified by vsp and idx. here's the vibe check on idx:
- if the metric has a singular value,
idxshould be0π - otherwise, the ordinal instance value identified by
idxgets unpacked, i.e.vsp->vlist[idx]β that one. exactly that one. no cap.
the unpacked records get turned into either pmResult or pmResult_v2 structures, one per event record and one metric per event parameter, and hrap or rap comes back to you as a pointer to an array (NULL pointer terminated) of pointers to those result structures. iconic behavior, honestly π
the only difference between the two result types is the timestamp scale:
pmResultallows for nanosecond precision β‘pmResult_v2allows for microsecond resolution π¬
β¨ the control info situation β¨
some control information from the packed event records gets unpacked into additional ``anonymous'' metrics, and here's the full rundown, no skipping, we don't do that here:
- if the event record has a non-zero
flagsvalue, then the correspondingpmResult/pmResult_v2will have the flags value encoded with the additional metricevent.flags, which is inserted ahead of all other event parameters. front of the line, main character energy π - if the event record flag is set to
PM_EVENT_FLAG_MISSED, then the correspondingpmResult/pmResult_v2will have one metricevent.missedwith 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 π we've all been there
π§ return values, the cute part π§
pmUnpackHighResEventRecords returns the number of pmResult structures 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. π
π cleanup era π
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). π«Ά
not me reminding you to free your memoryβ¦ bestie please free your memory. it's not a want, it's a need π
π RETURN VALUE π
the following errors are possible, and yes we're listing all of them, sit down and sip your strawberry drink π:
PM_ERR_CONVβ the values associated withvspare not encoded using the formatPM_VAL_DPTRorPM_VAL_SPTR, or the flags at the head of the event record has an unexpected value. the vibes are off, essentially πPM_ERR_INSTβ the value associated withvspis not singular as expected. it was supposed to be one (1) and it was not.PM_ERR_TYPEβvspis not a value of typePM_TYPE_HIGHRES_EVENTforpmUnpackHighResEventRecordsorPM_TYPE_EVENTforpmUnpackEventRecords. wrong type, wrong era, wrong everything.PM_ERR_TOOSMALLβ the value identified byvspis not legal because the value length is less than the minimum size, or the number of event records encoded in the (value header)pmHighResEventArray/pmEventArraystructure is negative, or the number of missed event records in the array is negative. negative?? in THIS economy?? πPM_ERR_TOOBIGβ eithervspindicates 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. π¨ that's the scary one, handle with carePM_ERR_TYPEβ event parameters must have one of the arithmetic types, elsePM_TYPE_AGGREGATE,PM_TYPE_STRINGorPM_TYPE_AGGREGATE_STATIC. (yes,PM_ERR_TYPEshows up twice in the original list β we're keeping both, we don't erase history π )- other values
< 0β refer topmErrStr(3).
β SEE ALSO β
PMAPI(3) and pmFreeEventResult(3). go read them, they're lowkey essential, iykyk πβ¨
and that's the whole page, bestie β brought to you by Performance Co-Pilot, PCP, on the date stamped in that footer, which we are absolutely not retyping because we're too busy slaying πππ
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2014 Red Hat
- Copyright (c) 2010 Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms