PMGETINDOM(3)

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

🌸 PMGETINDOM(3) β€” the pmGetInDom glow-up πŸ’…

okay bestie, welcome to PMGETINDOM, a.k.a. pmGetInDom from the PCP library functions manual ✨ this one's a little C function that goes and fetches all the instance identifiers for a performance metrics instance domain, and honestly? she's doing the most for you 🫢


✨ NAME ✨

pmGetInDom β€” get instance identifiers for a performance metrics instance domain πŸ’–


🌈 C SYNOPSIS 🌈

#include <pcp/pmapi.h>

int pmGetInDom(pmInDom indom, int **instlist, char ***namelist);

cc ... -lpcp

πŸ‘‘ DESCRIPTION πŸ‘‘

So here's the tea πŸ“: inside the current Performance Metrics Application Programming Interface (PMAPI) context, pmGetInDom goes and locates the description of the instance domain indom. Then it hands you back two things:

  • via instlist β€” the internal instance identifiers for all the instances πŸ”₯
  • via namelist β€” the full external identifiers for all the instances πŸ’–

The number of instances it found comes back to you as the function value. And if something went wrong? You get a value less than zero to indicate an error 😭 periodt.

ngl, the value for the instance domain indom is typically extracted from a pmDesc structure β€” which you get after calling pmLookupDesc(3) for whatever particular performance metric you're looking at πŸ‘€

🚨 memory management moment, bestie, do not skip this 🚨

The resulting lists of instance identifiers (instlist and namelist), and the names that the elements of namelist point to, will have been allocated by pmGetInDom with two calls to malloc(3). That means it is the responsibility of the caller to free(instlist) and free(namelist) to release that space when it's no longer required. yes, both. yes, really. it's giving chores but it's giving necessary chores πŸ’…

And listen β€” when the result of pmGetInDom is less than one, both instlist and namelist are undefined. No space will have been allocated, and so calling free(3) is a singularly bad idea πŸ’€ like genuinely do not. the vibe check fails. just don't.


🩺 DIAGNOSTICS 🩺

  • PM_ERR_INDOM β€” indom is not a valid instance domain identifier πŸ™ˆ

🌱 PCP ENVIRONMENT 🌱

Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5). Values for these variables may be obtained programmatically using the pmGetConfig(3) function. ✨


πŸ” SEE ALSO πŸ”


and that's the whole page, no cap πŸ’–βœ¨πŸŽ€

this lil icon of a manpage came to you courtesy of Performance Co-Pilot (that's the PCP girlies πŸ‘‘), and the page itself is PMGETINDOM(3) β€” go forth, free your mallocs, and slay πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from