PMDESTROYCONTEXT(3)

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

πŸ’… PMDESTROYCONTEXT(3) β€” bestie, we're cleaning up contexts today

okay so real talk, this is the pmDestroyContext page from section 3 of the manual, and it's literally the "bye babe, closing the connection" function. no cap.


✨ NAME ✨

pmDestroyContext β€” destroy a PMAPI context πŸ—‘οΈπŸ’–


🌸 C SYNOPSIS 🌸

#include <pcp/pmapi.h>

int pmDestroyContext(int handle);

cc ... -lpcp

like yes, that's the whole thing, she's simple but she's iconic πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

sooo an application using the Performance Metrics Application Programming Interface (PMAPI) can manipulate several concurrent contexts at once, and each one of those is associated with a source of performance metrics β€” for example pmcd(1) running on some host, or an archive of performance metrics as created by pmlogger(1). multiple vibes, multiple contexts, we love that for us πŸ’…

pmDestroyContext destroys the PMAPI context identified by handle. typically this would imply some termination of a connection to a PMCD or closing an archive file, and orderly clean-up. it's giving "we're leaving the party but we're taking our coat and saying goodbye properly" 🧚

🚨 the context must have been previously created using pmNewContext(3) or pmDupContext(3). no making up handles out of thin air, bestie, that's not the vibe.

on success, pmDestroyContext returns zero πŸŽ‰

but here's the tea πŸ“ β€” if handle was the current PMAPI context, then the current context becomes undefined. which means the application must explicitly re-establish a valid PMAPI context with pmUseContext(3), or create a new context with pmNewContext(3) or pmDupContext(3), before the next PMAPI operation that requires a PMAPI context. like, you can't just keep going, the app has to go get a new context first, periodt πŸ‘‘


😭 DIAGNOSTICS 😭

  • PM_ERR_NOCONTEXT β€” handle does not identify a valid PMAPI context. it's giving "who?? never heard of her" πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


Performance Co-Pilot 🌈 PCP β€” mwah, that's the source and the version right there, and this whole page is dated PMDESTROYCONTEXT(3) energy. stay hydrated, close your contexts, and go slay πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from