PMADDDERIVEDTEXT(3)
π PMADDDERIVEDTEXT(3) β the pmAddDerivedText era π
okay bestie, sit down, hydrate, because today we're talking about Performance Co-Pilot's very own pmAddDerivedText from the Library Functions Manual, and honestly? it's giving "tiny function, big feelings" π
β¨ NAME β¨
pmAddDerivedText β add help text for a derived metric π«Ά
πΈ C SYNOPSIS πΈ
#include <pcp/pmapi.h>
int pmAddDerivedText(const char *name, int type, const char *text);
cc ... -lpcp
no cap, that's the whole signature. three args, one int back, and the cc ... -lpcp at the bottom is your little reminder to link against libpcp or literally nothing works π
π¦ DESCRIPTION π¦
okay so first, the lore. Derived metrics are how you extend the Performance Metrics Name Space (PMNS) with brand new metrics that you define on the PCP client-side, using expressions over the performance metrics that already exist. it's like DIY but for metrics. iconic behavior β¨
so the derived metrics come into existence in two flavors:
- Global derived metrics β defined using
pmRegisterDerived(3)orpmRegisterDerivedMetric(3)orpmLoadDerivedConfig(3) - Per-context derived metrics β defined using
pmAddDerived(3)orpmAddDerivedMetric(3)
once a derived metric has been defined, pmAddDerivedText is the girl you call to associate help text with the derived metric identified by name. like, now your metric has a little bio. a blurb. a whole personality π
and the help text can be either vibe:
- a "one line" summary β pass
typeasPM_TEXT_ONELINE - a more verbose "multi-line" block of text β pass
typeasPM_TEXT_HELP
and yes, you can absolutely have both. to associate both styles of help text with a derived metric, you'd call pmAddDerivedText twice with different values for type. two calls, two texts, one very well-documented metric π
β οΈ okay important: once a particular type of help text has been associated with a derived metric, it cannot be deleted or redefined. periodt. so get it right the first time, bestie π
lastly, apps using the Performance Metrics Application Programming Interface (PMAPI) can retrieve help text for specific metrics using pmLookupText(3). so all that text you added? it's findable. it's living its best life. it's searchable π
π DIAGNOSTICS π
pmAddDerivedText returns zero on success, else an error code. so zero = slay, anything else = read the room (and the error code).
PM_ERR_NAMEβ this meansnamedoes not correspond to a previously defined derived metric. like, you're calling for a metric that doesn't exist yet. define it first, babe πPM_ERR_TEXTβ repeated calls for the samenameandtypewill result in this return value. you already gave it a bio, stop rewriting it πPM_ERR_ARGβ this meanstypeis not one of the expected values. it's notPM_TEXT_ONELINE, it's notPM_TEXT_HELP, it's just wrong. vibe check failed π«
π SEE ALSO π
PCPIntro(1), pmAddDerived(3), pmAddDerivedMetric(3), PMAPI(3), pmLoadDerivedConfig(3), pmLookupText(3), pmRegisterDerived(3), pmRegisterDerivedMetric(3) and PMNS(5).
and that's the whole page, bestie!! this manual page came to you courtesy of Performance Co-Pilot β PMADDDERIVEDTEXT(3), Library Functions Manual, out here doing the absolute most so your derived metrics can have help text like the main characters they are πβ¨ go add some text, you've got this, iykyk π«Ά
π¦ 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) 2023 Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms