PMTRIMNAMESPACE(3)
π PMTRIMNAMESPACE π
okay bestie, we're doing pmTrimNameSpace(3) from the Library Functions Manual and honestly? it's giving β¨ spring cleaning for your metrics β¨. no cap.
πΈ NAME πΈ
pmTrimNameSpace β prune a performance metrics name space πͺ΄βοΈ
π C SYNOPSIS π
#include <pcp/pmapi.h>
int pmTrimNameSpace(void);
cc ... -lpcp
like, that's the whole thing. one function. no arguments. she's simple, she's elegant, she eats π
β¨ DESCRIPTION β¨
so here's the tea, bestie π. in some (rare) cases β like, genuinely rare, don't come for me β it's actually helpful to prune the Performance Metrics Name Space (PMNS) so it matches the metrics that are actually available. vibe check your namespace, basically. π₯
the default PMNS that a Performance Metrics Application Programming Interface (PMAPI) client can access is provided by the current PMAPI context, and it depends on which flavor of context you've got going on:
- for a PMAPI context of type
PM_CONTEXT_HOST, the PMNS is provided bypmcd(1)on the associated host, and no pruning is required β she's already fresh β¨ - for a PMAPI context of type
PM_CONTEXT_ARCHIVE, the PMNS is stored within the associated Performance Co-Pilot (PCP) archive, and again, no pruning is required π - for a PMAPI context of type
PM_CONTEXT_LOCAL, at the first PMAPI call that needs access to the PMNS, it gets loaded from the default local location$PCP_VAR_DIR/pmns/root(or$PMNS_DEFAULT), and β say it with me β no pruning is required π
if the default PMNS is in effect, then calling pmTrimNameSpace is a no-op and returns zero, with no change to the PMNS. she literally does nothing and she's valid for it π
but wait, there's more π. PMAPI clients also have the option of over-riding that default PMNS by loading a local PMNS from a file β peep PMNS(5) for the format, iykyk β by calling pmLoadASCIINameSpace(3) or pmLoadNameSpace(3). that's the situation where some PMNS pruning might actually be useful. main character moment fr fr.
if a local PMNS is in effect when pmTrimNameSpace gets called, then the first thing she does is restore the PMNS to the state as of the completion of the last pmLoadASCIINameSpace(3) or pmLoadNameSpace(3). this is so that the effects of consecutive calls to pmTrimNameSpace are not additive β no stacking, no compounding, we reset every time bestie π§
after that reset, what pmTrimNameSpace does next depends on the type of the current PMAPI context:
- for a context of type
PM_CONTEXT_ARCHIVE, the local PMNS is trimmed to exclude metrics for which no description can be found in the PCP archive. then the PMNS is further trimmed to remove empty subtrees that do not contain any performance metric πΏ. since PCP archives usually contain some subset of all the metrics named in a PMNS,pmTrimNameSpaceeffectively prunes the application's PMNS down to contain only the names of the metrics in the archive. decluttered. iconic. periodt. π - for a context of type
PM_CONTEXT_HOSTorPM_CONTEXT_LOCAL, no further action is required β nothing to do, go touch grass π
on success, pmTrimNameSpace returns zero. π«Ά
π DIAGNOSTICS π
PM_ERR_NOPMNSβ there has been some earlier problem with establishing the relevant PMNS π like something went sideways before you even got herePM_ERR_NOCONTEXTβ the current PMAPI context is invalid π« bestie the context is not contexting
π SEE ALSO π
pmlogger(1), PMAPI(3), pmLoadASCIINameSpace(3), pmLoadNameSpace(3), pmNewContext(3) and PMNS(5).
ngl this one's short and sweet, so go forth and prune responsibly π¦
okay that's the whole page bestie, mwah π this little gem comes to you from Performance Co-Pilot over at PCP β go drink some water and call pmTrimNameSpace on your own life β¨ππ«Ά
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms