PMDUPCONTEXT(3)

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

✨ NAME ✨

pmDupContext β€” duplicate a PMAPI context πŸ’– (yes bestie, it's exactly what it sounds like)


🌸 C SYNOPSIS 🌸

#include <pcp/pmapi.h>

int pmDupContext(void);

cc ... -lpcp

πŸ’… DESCRIPTION πŸ’…

okay so picture this: your app is out here using the Performance Metrics Application Programming Interface (PMAPI, iykyk) and it's juggling several concurrent contexts at the same time πŸ‘‘. Each one of those contexts is tied to its own lil source of performance metrics β€” like pmcd(1) running on some host, or a whole set of archives of performance metrics as created by pmlogger(1) πŸ—‚οΈ.

So when you call pmDupContext, it replicates the current PMAPI context and hands you back a handle for the brand-new context πŸ”₯. That handle is literally made to be passed into subsequent calls of pmUseContext(3), slay.

And here's the part that's giving main character energy: once it's created, the duplicated context and the original context exist independently πŸ¦‹. So their instance profiles and their collection time β€” which, quick note, is only relevant for archive contexts β€” can each be varied on their own, no strings attached πŸŽ€.

Also, plot twist: the newly replicated context becomes the current context. Periodt πŸ’….


πŸ’œ SEE ALSO πŸ’œ


k that's the whole vibe, bestie 🫢 this was Performance Co-Pilot, PCP β€” mwah, no notes, go duplicate responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from