PMSEMSTR(3)

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

πŸ’– PMSEMSTR(3) πŸ’–

okay so bestie, this is a page from the Library Functions Manual β€” yes, that library manual, the one for the library functions πŸ’… and today's main character is pmSemStr (plus its little sibling pmSemStr_r, we love a duo).


✨ NAME ✨

pmSemStr, pmSemStr_r β€” convert a performance metric semantic into a string πŸ¦‹


🌸 C SYNOPSIS 🌸

#include <pcp/pmapi.h>

const char *pmSemStr(int sem);
char *pmSemStr_r(int sem, char *buf, int buflen);

cc ... -lpcp

like, yes, you gotta link with -lpcp, don't forget, she's the whole point 🫢


πŸŽ€ DESCRIPTION πŸŽ€

so basically, you hand pmSemStr a performance metric semantic and she gives you back a terse ASCII equivalent β€” the kind of string you'd actually want to shove into an error message or a diagnostic message. it's giving "short, sweet, useful" ✨

pmSemStr_r does exactly the same thing, no cap, except she stores the result in a user-supplied buffer called buf, and that buffer has length buflen. and like β€” heads up β€” that buffer should have room for at least 20 bytes. 20. at least. don't be stingy with her 😭

where does sem even come from though? bestie, it's typically extracted from a pmDesc structure, after you've called pmLookupDesc(3) for whichever performance metric you care about. so like, pmLookupDesc(3) first, then pull the semantic out of the pmDesc, then vibe check it with pmSemStr. the pipeline is iconic πŸ‘‘

some examples so you get the flavor:

  • counter β€” for when sem equals PM_SEM_COUNTER πŸ“ˆ
  • discrete β€” for when sem equals PM_SEM_DISCRETE 🎲
  • instant β€” for when sem equals PM_SEM_INSTANT ⚑
  • and etc. β€” yeah there's more, that's the vibe 🌈

🧚 NOTES 🧚

both of these routines are safe to call from threaded applications. periodt. no asterisk, no fine print, go off πŸ’œ


⭐ SEE ALSO ⭐


ngl the whole *Str family is lowkey a whole friend group and pmSemStr is just the one who tells you what a semantic is in human words. obsessed πŸ’–

and that's the whole page bestie!! this came to you courtesy of Performance Co-Pilot (PCP), and yeah the manual itself is labeled PMSEMSTR(3) because we keep the branding consistent around here πŸŽ€πŸŒΈβœ¨

πŸ“¦ where this page comes from