PMTYPESTR(3)

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

πŸ’… 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 🫢


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