PMDERIVEDCONTROL(3)
β¨ PMDERIVEDCONTROL(3) β¨
okay bestie, this one lives in the Library Functions Manual section of the PCP docs and it's literally the remote control for derived metrics π no cap.
πΈ NAME πΈ
pmGetDerivedControl, pmSetDerivedControl β get and set controls for derived metrics. yes, the name is doing exactly what it says on the tin, we love a transparent icon π«Ά
π C SYNOPSIS π
#include <pcp/pmapi.h>
int pmGetDerivedControl(int what, int *valuep);
int pmSetDerivedControl(int what, int value);
cc ... -lpcp
π¦ DESCRIPTION π¦
So these routines are your little knobs-and-dials situation for the derived metric services ποΈ β specifically the ones that get activated for global derived metrics via pmRegisterDerived(3), pmRegisterDerivedMetric(3) and pmLoadDerivedConfig(3), or for per-context derived metrics via pmAddDerived(3) and pmAddDerivedMetric(3).
The what argument picks which control or option you're talking about, the value argument is what you hand to pmSetDerivedControl, and the valuep argument is where pmGetDerivedControl drops the answer back for you π
what has to be one of these, no substitutions:
PCP_DERIVED_GLOBAL_LIMITβ the max number of global derived metrics that may be defined. the value should be greater than zero, or-1(which means no limit, live your truth). the initial value is-1.PCP_DERIVED_CONTEXT_LIMITβ the max number of per-context derived metrics that may be defined. the value should be greater than zero, or-1(again: no limit). the initial value is-1.PCP_DERIVED_DEBUG_SYNTAXβ debug diagnostics during parsing of the derived metric expression. value1turns the diagnostics on,0turns them off. the initial value is0.PCP_DERIVED_DEBUG_SEMANTICSβ debug diagnostics for semantic checks during the binding of metrics in the derived metric expression to the available metrics in a new PMAPI context. value1enables the diagnostics,0disables them. the initial value is0.PCP_DERIVED_DEBUG_EVALβ debug diagnostics when derived metrics get used in PMAPI operations likepmFetch(3),pmGetChildren(3),pmGetChildrenStatus(3),pmLookupDesc(3),pmLookupName(3),pmNameAll(3),pmNameID(3)andpmTraversePMNS(3). value1enables the diagnostics,0disables them. the initial value is0.PCP_DERIVED_OPTION_NOVALUEβ okay so when a performance metric (one being used as an operand inside a derived metric expression) is not available β think missing from a PCP archive context, or not provided by any PMDA for a host context β the default behaviour is to mark the derived metric as undefined. but if you set this option to1(default is0), then any metric that isn't available gets mapped to thenovalue()constructor instead (peeppmRegisterDerived(3)for the details). which basically means the metric is defined, but attempts to retrieve values viapmFetch(3)will returnPM_ERR_VALUE(Missing metric value(s)). it's giving "technically present, emotionally unavailable" π
π RETURN VALUES π
Both routines return 0 on success. otherwise you get a value less than 0, and you can decode it with pmErrStr(3).
There's some overloading of error codes going on here, needed to accommodate the unusual semantics of these routines β described below, bestie, don't shoot the messenger π
PM_ERR_NAMEβwhatis not one of the expected values.PM_ERR_ARGβ the value provided topmSetDerivedControlis not within the acceptable range.PM_ERR_NOCONTEXTβ getting or settingPCP_DERIVED_CONTEXT_LIMITonly makes sense when there is a current PMAPI context.PM_ERR_AGAINβ thepmSetDerivedControlrequest would violate precedence rules (see below, they're coming, stay with me).
π OTHER OPTIONS π
All of the controls and options that pmSetDerivedControl exposes can also be set in two other ways. two!! choices!! main character energy fr fr β
- Setting the
PCP_DERIVED_CONTROLenvironment variable to a value of the formname=integer, wherenameis one of thewhatmacros described above, stripped of thePCP_DERIVED_prefix β e.g.novalue=1.nameis case insensitive and multiple specifications are allowed, separated by commas. No whitespace is allowed. (whitespace is not the vibe, apparently π) - Use of a
#controlline in a derived metric configuration file, where the text following the#controlfollows exactly the same rules as for thePCP_DERIVED_CONTROLenvironment variable described above. iconic, consistent, we stan.
So given these options can be specified in multiple ways, possibly with different values, here are the precedence rules: if PCP_DERIVED_CONTROL is set, then that value is honoured. else, the most recently set value from #control or pmSetDerivedControl is used. periodt. π₯
π SEE ALSO π
PCPIntro(1), pmAddDerived(3), pmAddDerivedMetric(3), PMAPI(3), pmErrStr(3), pmLoadDerivedConfig(3), pmRegisterDerived(3), pmRegisterDerivedMetric(3) and PMNS(5).
and that's the whole page bestie, no crumbs left π this one's from Performance Co-Pilot, page PMDERIVEDCONTROL(3) β go forth and control your derived metrics responsibly, mwah πβ¨
π¦ 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.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.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) 2020 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