PMDACHILDREN(3)
π PMDACHILDREN(3) π
okay bestie, gather round, because this one is a library functions manual page from the PCP girlies and it's lowkey iconic β¨
πΈ NAME πΈ
pmdaChildren β the way that you translate a PMID into a whole set of dynamic performance metric names π¦
π C SYNOPSIS π
#include <pcp/pmapi.h>
#include <pcp/pmda.h>
int pmdaChildren(char *name, int traverse, char ***offspring,
int **status, pmdaExt *pmda);
cc ... -lpcp_pmda -lpcp
β¨ DESCRIPTION β¨
so basically, as part of the Performance Metrics Domain Agent (PMDA) API (go peek at PMDA(3) if you haven't, bestie), pmdaChildren is the generic callback for returning dynamic metric names (and their status, obviously) that are descendants of name. periodt π
now here's the tea: implementing dynamic performance metrics needs specific PMDA support, and the whole facility is an optional component of a PMDA (most PMDAs simply do not support dynamic performance metrics, sad but true π). so pmdaChildren is a skeleton implementation that just returns PM_ERR_NAME. it's giving placeholder energy, ngl.
a PMDA that does support dynamic performance metrics will hand you a private callback that replaces pmdaChildren β you do that by assignment to version.four.children of the pmdaInterface structure π β and that callback takes the initial metric name and returns names via offspring[], plus the leaf or non-leaf status of each one via status[].
okay so the traverse thing, let's break it down:
- if
traverseis0, the behaviour is akin topmGetChildren(3)andoffspring[]contains the relative name component for the immediate descendants ofname. just the immediate ones, bestie, no going deeper π«Ά - if
traverseis1, the behaviour is akin topmTraversePMNS(3)andoffspring[]contains the absolute names of all dynamic metrics that are descendants ofname. the whole family tree, no cap π
now, memory management, because we love a responsible queen:
the resulting list of pointers offspring and the string values (the names) that the pointers reference will have been allocated by pmdaChildren with a single call to malloc(3), and the caller of pmdaChildren will call free(offspring) to release the space when it is no longer required. same holds true for the status array β namely, the caller of pmdaChildren will call free(status) to release the space when it is no longer required. one malloc, two frees, we stay organized π
β οΈ CAVEAT β οΈ
the PMDA must be usingPMDA_INTERFACE_4or later, as specified in the call topmdaDSO(3)orpmdaDaemon(3). not optional, not negotiable, fr fr π
π₯ DIAGNOSTICS π₯
pmdaChildren returns PM_ERR_NAME if the name is not recognized or cannot be translated, otherwise it returns the number of descendent metric names found. so like, either a sad little error or a whole count of your metric babies πΈ
π¦ SEE ALSO π¦
PMAPI(3), PMDA(3), pmdaDaemon(3), pmdaDSO(3), pmdaMain(3), pmGetChildren(3) and pmTraversePMNS(3). go read them, iykyk π
Performance Co-Pilot Β· PCP Β· PMDACHILDREN(3)
and that's the whole page, bestie π mwah, go forth and free your arrays, you absolute main character π β¨
π¦ 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: libpcp-pmda3-dev 7.1.1-1
- ubuntu stonking: libpcp-pmda3-dev 7.2.1-2build1
- Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved
- Copyright (c) 2009 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