PMSPECLOCALPMDA(3)

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

πŸ’– PMSPECLOCALPMDA(3) πŸ’–

so this is a page from the Library Functions Manual, and honestly? it's giving "tiny helper function that saves your whole app". buckle up bestie 🫢


✨ NAME ✨

pmSpecLocalPMDA β€” the lil function that processes a command-line argument for the table of DSO PMDAs. periodt.


🌸 C SYNOPSIS 🌸

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

char *pmSpecLocalPMDA(const char *spec);

cc ... -lpcp

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, for Performance Co-Pilot (PCP) applications, contexts of type PM_CONTEXT_LOCAL are the ones clients use when they wanna fetch metrics directly from one or more PMDAs on the local host, no pmcd(1) involved. just you and the PMDAs, one-on-one. πŸ’…

pmSpecLocalPMDA is basically the convenience wrapper for apps that want a command line argument (usually with -K) to control which DSO PMDAs are available for a PM_CONTEXT_LOCAL context. it's the vibe curator of your DSO table, no cap.

the spec argument tells it what to do with one or more DSO PMDAs, using up to four fields separated by commas (`,`). the fields are, in order:

  • an opcode with one of the values add (add a new entry), del (delete an existing entry) or clear (clear all entries from the table).
  • the PMDA's domain number
  • the path to the PMDA DSO (may be absolute, or relative to the $PCP_VAR_DIR/pmdas directory, and the DSO suffix is optional) β€” yes the suffix is optional, she's flexible like that πŸ’…
  • the name of the PMDA's initialization routine

rules of the game, bestie:

  • All fields are required to add a new entry. no skipping, it's giving all-or-nothing.
  • To delete an entry, the opcode is required plus either or both of the domain number and path fields. pick your fighter.
  • To clear all entries, only the opcode is required. that's it. that's the whole requirement. iconic.

and if spec is parsed successfully, the DSO table gets updated with the extracted fields. slay. ✨


πŸ”₯ RETURN VALUE πŸ”₯

  • On success, pmSpecLocalPMDA will return NULL. yes, NULL is the good news here, we love a function that flips the script πŸ™ˆ
  • On error or failure, pmSpecLocalPMDA will return a pointer to a static error message. so like... look but don't touch, don't go freeing it.

πŸŽ€ EXAMPLES πŸŽ€

some examples of valid spec strings, because i know you were gonna ask:

  • clear β€” Delete all entries from the DSO table. the nuclear option. it's giving fresh start, new me. πŸ’€
  • add,123,foo/foo_pmda,foo_init β€” Add the foo'' PMDA using domain 123. The PMDA's DSO is most likely in below the directory `$PCP_PMDAS_DIR` and named `foo/foo_pmda.so` (for ELF-style platforms) or `foo/foo_pmda.dylib` (for BSD-style platforms) or `foo\foo_pmda.dll` (for Windows-style platforms). The initialization routine for the foo'' PMDA is foo_init(). so she's cross-platform, she contains multitudes. 🌈
  • del,123 β€” Delete the entry for the DSO with domain 123. bye boo πŸ‘‹
  • del,,foo/foo_pmda β€” Delete the entry with a pathname to the DSO that matches foo/foo_pmda. notice the double comma, that's the empty domain field just vibing there. don't panic.
  • del,123,foo/foo_pmda β€” Delete the entry for the DSO with either domain 123 and/or a pathname to the DSO that matches foo/foo_pmda.

πŸ’œ SEE ALSO πŸ’œ

pmcd(1), PMAPI(3) and pmNewContext(3). go read them, iykyk. πŸ“š


and that's the whole page bestie!! this one came to you straight from Performance Co-Pilot, filed under PMSPECLOCALPMDA(3). go forth, parse your specs, and update that DSO table like the main character you are πŸ‘‘πŸ’–

πŸ“¦ where this page comes from