PMLOADNAMESPACE(3)

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

πŸ’– PMLOADNAMESPACE(3) πŸ’–

okay bestie, so this one lives in the Library Functions Manual section, and it's literally all about loading a local PMNS for your app. sit down, grab a boba, we're doing this πŸ§‹βœ¨


🌸 NAME 🌸

pmLoadNameSpace β€” load a local PMNS for an application πŸ’…


✨ C SYNOPSIS ✨

#include <pcp/pmapi.h>

int pmLoadNameSpace(const char *filename);

cc ... -lpcp

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: if your application wants to force using a local Performance Metrics Name Space (PMNS) instead of a distributed PMNS, then it has to load the PMNS using pmLoadNameSpace or pmLoadASCIINameSpace(3). that's the whole deal, no cap.

but if your app is gonna use a distributed PMNS? then it should NOT call anything to load the PMNS explicitly. don't do it. put the phone down. πŸ™ˆ

most applications using a Performance Metrics Application Programming Interface (PMAPI) context β€” and that's any type, so PM_CONTEXT_HOST or PM_CONTEXT_ARCHIVE or PM_CONTEXT_LOCAL β€” should not need to call pmLoadNameSpace at all. like, you're probably fine, bestie. 😌

the filename argument designates the PMNS of interest. for applications not requiring a tailored PMNS, the special value PM_NS_DEFAULT may be used for filename, to force the default local PMNS to be loaded. cute, right? πŸŽ€

the default local PMNS is found in the file $PCP_VAR_DIR/pmns/root β€” unless the environment variable PMNS_DEFAULT is set, in which case the value is assumed to be the pathname to the file containing the default local PMNS. iykyk.

externally, a PMNS is stored in an ASCII format as described in PMNS(5). but β€” and this is the part where you need to pay attention β€” note that pmLoadNameSpace assumes filename does not contain any C-style comments, preprocessor directives or macros. if that's not the case, pmLoadASCIINameSpace(3) should be used instead. periodt.

as of Version 3.10.3 of PCP, by default, multiple names in the PMNS are allowed to be associated with a single Performance Metrics Identifier (PMID), and this is unconditionally allowed by pmLoadNameSpace. pmLoadASCIINameSpace(3) provides an alternative interface with user-defined control over the handling of duplicate names for the same PMID in the PMNS. so if you want choices, go there. πŸ‘‘

pmLoadNameSpace returns zero on success. slay. βœ…


😭 DIAGNOSTICS 😭

syntax and other errors in the parsing of the PMNS are reported on stderr with a message of the form:

Error Parsing ASCII PMNS: ...
  • PM_ERR_DUPPMNS β€” it is an error to try and load more than one PMNS, or to call either pmLoadNameSpace and/or pmLoadASCIINameSpace(3) more than once. one PMNS, one call, that's the rule, don't be messy. πŸ’€
  • PM_ERR_PMNS β€” syntax error in the PMNS file. oops. πŸ™ˆ

πŸŽ€ FILES πŸŽ€

  • $PCP_VAR_DIR/pmns/root β€” the default local PMNS, when the environment variable PMNS_DEFAULT is unset

🌈 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. very demure, very mindful. 🧚


πŸ‘‘ SEE ALSO πŸ‘‘

PMAPI(3), pmGetConfig(3), pmLoadASCIINameSpace(3), pmTrimNameSpace(3), pcp.conf(5), pcp.env(5) and PMNS(5). go read them, bestie, they're iconic fr fr πŸ“šπŸ’œ


and that's the whole page, no skips, no shortcuts πŸ’–

okay love you bye β€” this has been your girl from Performance Co-Pilot (PCP), signing off, and yes the page itself is literally called PMLOADNAMESPACE(3) so go off, you understood the assignment 🫢✨

πŸ“¦ where this page comes from