PMIPUTRESULT(3)

πŸ“¦ version 7.2.2, in arch rolling, fedora 43, fedora 44

πŸ’– PMIPUTRESULT(3) πŸ’–

okay bestie, so this one's from the PCP Library Functions Manual and it's all about pmiPutResult and pmiPutHighResResult β€” two lil functions that just wanna add a data record to a LOGIMPORT archive. that's the whole vibe. let's get into it 🫢


✨ NAME ✨

pmiPutResult, pmiPutHighResResult β€” add a data record to a LOGIMPORT archive. that's it, that's the name section, she's short and iconic πŸ’…


🌸 C SYNOPSIS 🌸

#include <pcp/pmapi.h>
#include <pcp/import.h>

int pmiPutResult(const pmResult_v2 *result);
int pmiPutHighResResult(const pmResult *result);

cc ... -lpcp_import -lpcp

yup, link against -lpcp_import and -lpcp, don't forget it or the linker will literally ghost you 😭


πŸ¦‹ Python SYNOPSIS πŸ¦‹

from pcp import pmi

log.put_result(result)
log.put_highres_result(result)

python girlies stay winning, you just call it on your log object πŸŽ€


🌈 DESCRIPTION 🌈

so this is part of the Performance Co-Pilot Log Import API (peep LOGIMPORT(3) for the whole story). these routines are giving "for the developers who already know the internal PCP data structures" energy, and they let you create output archives directly. no middleman. main character behavior honestly.

the whole point: if you build a pmResult data structure yourself and then call one of these routines, you skip the whole rigmarole of calling pmiPutValue(3) and/or pmiPutValueHandle(3) and then pmiHighResWrite(3) for every single record you write to the archive. bye to all that, we're efficient now ✨

pmiPutHighResResult is the preferred interface. say it louder for the people in the back πŸ“£

here's the breakdown, bestie:

  • pmiPutHighResResult β€” the queen, the one you should be using. she accepts a pmResult with a struct timespec timestamp, which means nanosecond resolution and Y2038-safe 64-bit seconds. future-proof AND precise, we love to see it πŸ‘‘
  • pmiPutResult β€” the older sibling. accepts the legacy pmResult_v2 type with a struct timeval timestamp, so we're talking microsecond resolution. still valid, just not the moment anymore.

now, important one, don't skip this: any metrics and instances showing up in result must have already been defined by earlier calls to pmiAddMetric(3) and pmiAddInstance(3). like, they have to exist first. no sneaking new ones in, okay?

the good news? both routines will handle it for you and arrange for any new metadata (that's metrics and/or instance domain changes) covered by result to be written to the PCP archive. so they do the admin work, you just vibe πŸ’œ

⚠️ and here's the sad part: because the pmResult data structure is genuinely complex, neither routine is available in the Perl interface to the LOGIMPORT services. perl besties, i'm so sorry, this one's not for us 😭

πŸ’€ DIAGNOSTICS πŸ’€

both routines return zero on success β€” slay. otherwise you get a negative value, and you can turn that into an actual readable error message by calling pmiErrStr(3). never leave a negative return value un-investigated bestie, that's how you end up confused at 3am πŸ₯²


πŸŽ€ SEE ALSO πŸŽ€

the whole squad, go read them:

LOGIMPORT(3), PMAPI(3), pmiAddInstance(3), pmiAddMetric(3), pmiErrStr(3), pmiPutValue(3), pmiPutText(3), pmiPutLabel(3), pmiPutValueHandle(3), pmiSetTimezone(3), pmiHighResWrite(3) and pmiWrite(3).


and that's the whole page bestie!! πŸ’– this came to you from the fine folks at Performance Co-Pilot, and you just read PMIPUTRESULT(3) β€” go forth and write those archives with nanosecond precision, no cap βœ¨πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from