PMTYPESTR(3)
π
PMTYPESTR(3) β the pmTypeStr / pmTypeStr_r glow-up π
okay bestie, welcome to the Library Functions Manual section, PCP edition β¨ this is where we turn a performance metric type into a cute little string, no cap.
πΈ NAME πΈ
pmTypeStr, pmTypeStr_r β convert a performance metric type into a string π¦
β¨ C SYNOPSIS β¨
#include <pcp/pmapi.h>
const char *pmTypeStr(int type);
char *pmTypeStr_r(int type, char *buf, int buflen);
cc ... -lpcp
yes queen, that's the whole vibe. two functions, one include, one linker flag. iconic. π
π DESCRIPTION π
so here's the tea β β you hand pmTypeStr a performance metric type, and it hands you back a terse ASCII equivalent, which is exactly what you want for error and diagnostic messages. it's giving "short and useful", fr fr.
The pmTypeStr_r function does the same thing, except it stores the result in a user-supplied buffer β that's buf, with length buflen. and bestie, listen: that buffer should have room for at least 20 bytes. don't skimp on the buffer, it's not the moment π
The value for type is typically extracted from a pmDesc structure, following a call to pmLookupDesc(3) for a particular performance metric. iykyk π
Examples are 32 (for type equals PM_TYPE_32), U64 (for type equals PM_TYPE_U64), STRING (for type equals PM_TYPE_STRING), etc. etc. etc. β the whole type lineup showing out in its string form β¨
π¦ NOTES π¦
Both of these functions are safe to call from threaded contexts. slay, go forth and thread responsibly π
π₯ SEE ALSO π₯
the whole friend group, no one left out π«Ά
PMAPI(3)pmAtomStr(3)pmConvScale(3)pmExtractValue(3)pmLookupDesc(3)pmPrintValue(3)pmIDStr(3)pmInDomStr(3)pmSemStr(3)pmUnitsStr(3)
and that's the page, bestie π brought to you by Performance Co-Pilot (PCP), filed under PMTYPESTR(3) β go convert those types and be the main character of your own diagnostics πβ
π¦ 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