__pmContextWalk - Man Page

traversal of all PMAPI contexts

C Synopsis

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

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

cc ... -lpcp

Caveat

This documentation is intended for internal Performance Co-Pilot (PCP) developer use.

These interfaces are not part of the PCP APIs that are guaranteed to remain fixed across releases, and they may not work, or may provide different semantics at some point in the future.

Description

__pmContextWalk provides a thread-safe and lock-safe way of processing each active PMAPI context in turn.

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 is not otherwise accessed by __pmContextWalk, so could be NULL.

The per-context c_lock is released by __pmContextWalk after callback is called and should not be unlocked by callback.

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.

Return Values

__pmContextWalk returns the number of contexts processed and hence the number of times callback was called, else a negative value suitable for reporting with pmErrStr(3).

See Also

PMAPI(3), pmDestroyContext(3), pmDupContext(3), pmErrStr(3), pmNewContext(3) and pmReconnectContext(3).

Info

PCP Performance Co-Pilot