PMIDSTR(3)
π PMIDSTR(3) π
okay bestie, so this is a page from the Library Functions Manual for PCP, and it's literally about turning a performance metric identifier into something your eyeballs can actually read. slay.
β¨ NAME β¨
pmIDStr, pmIDStr_r β convert a performance metric identifier into a string π
β¨ C SYNOPSIS β¨
#include <pcp/pmapi.h>
const char *pmIDStr(pmID pmid);
char *pmIDStr_r(pmID pmid, char *buf, int buflen);
cc ... -lpcp
β¨ DESCRIPTION β¨
So the vibe here is: you're writing error messages and diagnostic stuff, right, and you need a version of the specified Performance Metric Identifier (PMID) that a human can look at without crying. That's pmIDStr β it hands you back a "human readable" version. π«Ά
pmIDStr_r does literally the same thing, except it stashes the result in a buffer you supply, called buf, of length buflen. And that buffer should have room for at least 20 bytes, no cap. π
Here's the tea about what's going on under the hood: internally a PMID is encoded with three fields β domain, cluster and item. pmIDStr gives you back a string with each of those fields showing up as decimal numbers, separated by periods. iconic. π
β οΈ and now the important part: the string value that comes back from pmIDStr lives in a single static buffer. so the returned value is only valid until the next call to pmIDStr. it's giving "use it or lose it" energy, fr fr.
β¨ NOTES β¨
pmIDStr returns a pointer to a static buffer and hence is not thread-safe. π
Multi-threaded applications should use pmIDStr_r instead. periodt.
β¨ 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). And you can grab values for these variables programmatically using the pmGetConfig(3) function. π
β¨ SEE ALSO β¨
PMAPI(3), pmGetConfig(3), pmInDomStr(3), pmTypeStr(3), pmSemStr(3), pmUnitsStr(3), pmLookupDesc(3), pcp.conf(5) and pcp.env(5). π
and that's the whole page bestie, go forth and stringify responsibly π¦π
Performance Co-Pilot made this one, and it's tagged PCP, dated with the rest of the PMIDSTR(3) crew β mwah, love that for them. πβ¨
π¦ 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