PMLOOKUPTEXT(3)

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

πŸ’– PMLOOKUPTEXT β€” bestie, let's get you a metric description πŸ’–

okay so picture this: you're deep in the Performance Co-Pilot (PCP) girlie world, and you've got a performance metric, right? But like… what is it? bestie, that's literally what this function is for. ✨


🌸 NAME 🌸

pmLookupText β€” return text describing a performance metric. that's it, that's the whole job, and it ate πŸ’…


πŸŽ€ C SYNOPSIS πŸŽ€

#include <pcp/pmapi.h>

int pmLookupText(pmID pmid, int level, char **buffer);

cc ... -lpcp

yes the link flag is -lpcp, do not forget her, she is essential 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So. You want the ✨lore✨ on a metric. pmLookupText retrieves descriptive text about the performance metric identified by pmid. That's the whole vibe.

Now the level argument? She's the vibe selector, and she has exactly two moods:

  • PM_TEXT_ONELINE β€” a one-line summary. short, punchy, the tweet version.
  • PM_TEXT_HELP β€” a more verbose description, suited to a help dialog. the long-form essay version, for when you need the whole story.

The space pointed to by buffer will have been allocated in pmLookupText with malloc(3), and it is the responsibility of the caller to free(3) the space when it is no longer required.

⚠️ not me leaving a malloc'd buffer un-freed… bestie. that's a leak. it's giving memory leak. don't do that. free(3) her when you're done, periodt. πŸ™ˆ

pmLookupText returns zero on success. zero = slay. πŸ‘‘


πŸ’€ DIAGNOSTICS πŸ’€

  • PM_ERR_NOTHOST β€” For archives created with versions of PCP prior to 4.0, if the current PMAPI context is an archive (help and one-line text was previously not maintained in the archives).

so like, if you're running against a really old archive (PCP before 4.0, ancient history fr fr), the help text and one-line text just… weren't kept. they were not maintained in the archives. the archives said "no thoughts, head empty" 😭 that's the error you get, and it's not your fault, it's the archive's era. πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

go read these, they're all iconic:

chkhelp(1), newhelp(1), PMAPI(3), pmGetConfig(3), pmLookupDesc(3), pmLookupLabels(3), pmLookupInDomText(3), pcp.conf(5) and pcp.env(5).


and that's the page bestie!! πŸŽ€ this one came to you from Performance Co-Pilot (PCP), filed under PMLOOKUPTEXT(3). mwah, go free(3) your buffers, ily πŸ’–πŸŒˆβœ¨

πŸ“¦ where this page comes from