PMCONTEXTWALK(3)

πŸ’– PMCONTEXTWALK(3) β€” the Library Functions Manual glow-up πŸ’–

okay so bestie, pull up a chair, because we're about to talk about __pmContextWalk β€” yes, from the Library Functions Manual section 3, and yes, she's serving internal-PCP realness. this one's for the devs who live inside the guts of Performance Co-Pilot, iykyk. 🫢


✨ NAME ✨

__pmContextWalk β€” traversal of all PMAPI contexts 🌈

like, all of them. every single active one. one by one. no cap.


✨ C SYNOPSIS ✨

#include "pmapi.h"
#include "libpcp.h"

void (*__pmContextWalkCallback)(void *handle, __pmContext *ctxp);
int __pmContextWalk(void *handle, __pmContextWalkCallback callback,

cc ... -lpcp

that's the whole thing, character for character, don't come for me. πŸ’…


🚨 CAVEAT 🚨

okay listen. this documentation is intended for internal Performance Co-Pilot (PCP) developer use. it's giving backstage-pass energy, not general-admission energy. 🎟️

these interfaces are not part of the PCP APIs that are guaranteed to remain fixed across releases. and like… they may not work, or they may provide different semantics at some point in the future. so don't build your whole personality on them, bestie. 😭

fr fr, treat this like a situationship, not a marriage.

πŸ’… DESCRIPTION πŸ’…

__pmContextWalk provides a thread-safe and lock-safe way of processing each active PMAPI context in turn. she's careful. she's considerate. she locks properly so you don't have to worry. queen behavior. πŸ‘‘

for each valid PMAPI context, callback is called with handle passed in from the __pmContextWalk caller, and ctxp pointing to a context for which the c_lock lock has been acquired. πŸ”

the handle argument is a pointer to an arbitrary object that may be shared between the __pmContextWalk caller and the callback routine β€” but it is not otherwise accessed by __pmContextWalk, so it could be NULL. do whatever you want with it, she doesn't care. πŸ™ˆ

the per-context c_lock is released by __pmContextWalk after callback is called, and should not be unlocked by callback. like, hands off the lock, babe, she's got it. βœ‹

for the duration of the call to __pmContextWalk, all context initiation (via pmNewContext(3), pmDupContext (3) or pmReconnectContext(3)) and teardown (via pmDestroyContext(3)) is blocked. πŸ›‘ everyone wait their turn, it's called manners.


🌸 RETURN VALUES 🌸

__pmContextWalk returns the number of contexts processed β€” and hence the number of times callback was called. so if you got a big number, she was busy. πŸ’ͺ

else, a negative value suitable for reporting with pmErrStr(3). negative = something went sideways, go ask pmErrStr(3) what's up. 😭


πŸ”₯ SEE ALSO πŸ”₯

go read those too, bestie, they're all part of the same friend group. πŸ¦‹


and that's the tea! this page came to you straight from Performance Co-Pilot / PCP β€” the PMCONTEXTWALK(3) icon herself. stay safe out there with your contexts, don't unlock locks you don't own, and remember: internal APIs are for the girlies who read the caveats. periodt. πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from