PMUSECONTEXT(3)

πŸ“¦
version 7.2.2 Β· 3 versions
, in arch rolling, centos-stream 10, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

PMUSECONTEXT(3) πŸ’–

okay so this is a page from the Library Functions Manual bestie, and it's all about pmUseContext from the Performance Co-Pilot (PCP) world πŸŽ€


✨ NAME ✨

pmUseContext β€” change current PMAPI context πŸ’…


🌸 C SYNOPSIS 🌸

#include <pcp/pmapi.h>

int pmUseContext(int handle);

cc ... -lpcp

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: if you're an application using the Performance Metrics Application Programming Interface (PMAPI, yes queen πŸ‘‘), you can juggle several concurrent contexts at once. Each one is tied to a source of performance metrics β€” like pmcd(1) running on some host, or an archive of performance metrics as created by pmlogger(1). Multiple vibes, multiple sources, all at the same time, no cap. ✨

Calling pmUseContext sets the current PMAPI context to the one identified by handle. And bestie, that handle value must be one returned from an earlier call to pmNewContext(3) or pmDupContext(3). Like, you can't just make one up, okay? πŸ™ˆ

Now here's the part that's giving main character energy: below the PMAPI, every context your application uses gets saved in its most recently modified state. So pmUseContext restores the context to the state it was in the last time the context was used β€” not the state of the context back when it was first established. It's giving "we pick up right where we left off," and honestly? Obsessed. πŸ’–


πŸ’€ DIAGNOSTICS πŸ’€

  • PM_ERR_NOCONTEXT β€” handle does not identify a valid PMAPI context 😭 (literally it doesn't know her)

πŸ‘‘ SEE ALSO πŸ‘‘

PMAPI(3), pmDestroyContext(3), pmDupContext(3), pmNewContext(3) and pmWhichContext(3). Go read those too, they ate. πŸ”₯


k bye ily, this was Performance Co-Pilot (PCP) content, PMUSECONTEXT(3), and yes it really is that iconic 🫢✨

πŸ“¦ where this page comes from