PMATOMSTR(3)
π PMATOMSTR π β it's a 3 page, library functions manual, bestie
okay so welcome to the PMATOMSTR glow-up β¨ this is pmAtomStr, pmAtomStr_r β literally the duo that takes a performance metric value and turns it into a string. diagnostic vibes, report vibes, all of it π
β¨ NAME β¨
pmAtomStr, pmAtomStr_r β convert a performance metric value into a string π¦
β¨ C SYNOPSIS β¨
#include <pcp/pmapi.h>
const char *pmAtomStr(const pmAtomValue *avp, int type);
char *pmAtomStr_r(const pmAtomValue *avp, int type, char *buf,
int buflen);
cc ... -lpcp
β¨ DESCRIPTION β¨
so like. every performance metric value can be encoded in a pmAtomValue union, and it is defined like this, no notes:
typedef union {
__int32_t l; /* 32-bit signed */
__uint32_t ul; /* 32-bit unsigned */
__int64_t ll; /* 64-bit signed */
__uint64_t ull; /* 64-bit unsigned */
float f; /* 32-bit floating point */
double d; /* 64-bit floating point */
char *cp; /* char ptr */
pmValueBlock *vbp; /* pmValueBlock ptr */
} pmAtomValue;
so you hand over the performance metric value that avp is pointing at, plus a performance metric type defined by type, and pmAtomStr will generate the corresponding metric value as a string β perfect for diagnostic or report output, it's giving very put-together π
pmAtomStr_r does the exact same thing but stores the result in a user-supplied buffer buf of length buflen, and that buffer should have room for at least 80 bytes. yes bestie, at least 80, don't skimp π
the value for type is typically extracted from a pmDesc structure, following a call to pmLookupDesc(3) for a particular performance metric. that's the move π
some type-specific tea, listen up:
- if the type is
PM_TYPE_STRING, values longer than 38 characters will be truncated after 34 characters, and that truncation is shown with ellipsis...at the end of the value. so it's not a glitch, it's on purpose π«Ά - if the type is
PM_TYPE_AGGREGATE, then up to the first three 32-bit words are displayed as hexadecimal values π₯ - if the type is
PM_TYPE_EVENT, then a summary of the number of event records found in the value is generated π
and here's the catch, bestie: the return value from pmAtomStr is held in a single static buffer, so the returned value is only valid until the next call to pmAtomStr. it's giving one-shot, use-it-or-lose-it energy π
β¨ NOTES β¨
pmAtomStrreturns a pointer to a static buffer and hence is not thread-safe. multi-threaded applications should usepmAtomStr_rinstead. periodt. π¨
β¨ SEE ALSO β¨
PMAPI(3), pmConvScale(3), pmExtractValue(3), pmLookupDesc(3), pmPrintValue(3), pmTypeStr(3) and pmUnitsStr(3) π
okay and that's the whole page, my love πΈ this came from Performance Co-Pilot (that's the PCP girlies, you know the ones), page PMATOMSTR(3). go read a metric and slay ππ
π¦ 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 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