PMLOCALPMDA(3)

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

πŸ’– PMLOCALPMDA(3) β€” the __pmLocalPMDA glow-up πŸ’–

okay bestie, so this one is a library functions manual page, and before you ask β€” yes it's giving internal-dev energy, not public-API energy. Let's get into it. πŸ¦‹


✨ NAME ✨

__pmLocalPMDA β€” change the table of DSO PMDAs for PM_CONTEXT_LOCAL contexts

Like, it literally just rearranges which PMDAs your local context can see. That's the whole vibe. πŸ’…


🌸 C SYNOPSIS 🌸

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

int __pmLocalPMDA(int op, int domain, const char *name,
                  const char *init);

and when you build it:

cc ... -lpcp

no cap, that's the whole setup. πŸŽ€


🚨 CAVEAT 🚨

bestie. listen. 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. So like… don't build your whole personality on them, okay? πŸ™ˆ


πŸ‘‘ DESCRIPTION πŸ‘‘

PCP contexts of type PM_CONTEXT_LOCAL are what clients use when they wanna fetch metrics directly from one or more PMDAs on the local host without involving pmcd(1). And a PMDA that's gonna be used this way must have been built as a Dynamic Shared Object (DSO). that's the rule, periodt. ✨

Historically, the table of PMDAs available for use with PM_CONTEXT_LOCAL was hardcoded to the following:

  • The PMDA (or PMDAs) that export the operating system performance data and data about process activity.
  • The mmv PMDA.
  • The sample PMDA provided $PCP_LITE_SAMPLE or $PMDA_LOCAL_SAMPLE is set in the environment β€” used mostly for QA and testing.

The initial table of PMDAs available for use with PM_CONTEXT_LOCAL is now generated dynamically from all those PMDAs that have been installed as DSOs on the local host. πŸŒ€ The one exception is the ``pmcd'' PMDA, which only operates correctly in the address space of a running pmcd(1) process and so is not available to an application using a PM_CONTEXT_LOCAL context. not invited to the party, sorry not sorry. πŸ’…

__pmLocalPMDA provides a number of services to amend the table of PMDAs available for use with PM_CONTEXT_LOCAL. 🫢

The op argument specifies the what should be done and takes one of the following values and actions:

  • PM_LOCAL_ADD β€” Append an entry to the table for the PMDA with a Performance Metrics Domain (PMD) of domain, the path to the DSO PMDA is given by path and the PMDA's initialization routine is init. ✨
  • PM_LOCAL_DEL β€” Removes all entries in the table where the domain matches, or the path matches. Setting the arguments domain to -1 or path to NULL to force matching on the other argument. The init argument is ignored. πŸ—‘οΈ
  • PM_LOCAL_CLEAR β€” Remove all entries from the table. All the other arguments are ignored in this case. πŸ’₯

The domain, name and init arguments have similar syntax and semantics to the associated fields in the pmcd(1) configuration file. The one difference is the path argument, which is used by __pmLocalPMDA to find a likely looking DSO by searching in this order: $PCP_PMDAS_DIR/path, path, $PCP_PMDAS_DIR/path.dso-suffix and finally path.dso-suffix (dso-suffix is the local platform specific default file name suffix for a DSO, e.g. so for Linux, dylib for macOS, dll for Windows, etc.). it goes hunting, she's thorough. πŸ”


πŸŽ€ RETURN VALUE πŸŽ€

In most cases, __pmLocalPMDA returns 0 to indicate success. πŸ₯³

If op is invalid, then the return value is PM_ERR_CONV β€” else if there is no matching table entry found for a PM_LOCAL_DEL operation, PM_ERR_INDOM is returned. 😭


πŸ¦‹ SEE ALSO πŸ¦‹

pmcd(1), PMAPI(3), pmNewContext(3) and pmSpecLocalPMDA(3).

go read those too, they're iconic, iykyk. πŸ’œ


and that's the whole page, bestie. slay. 🌈

Performance Co-Pilot put their name on this one, and the page is PMLOCALPMDA(3) β€” mwah, take care of her. πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from