PMNAMEALL(3)

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

πŸ’– PMNAMEALL(3) β€” the library-functions-manual girlypop edition πŸ’–

okay bestie, welcome to section 3 of the manual (library functions, we love her), and today's main character is pmNameAll. she's a lil PCP function and her whole job is: you hand her a PMID, she hands you back every name that points at it. no cap. ✨


🌸 NAME 🌸

pmNameAll β€” translate a PMID to a set of performance metric names πŸ¦‹


✨ C SYNOPSIS ✨

#include <pcp/pmapi.h>

int pmNameAll(pmID pmid, char ***nameset);

cc ... -lpcp

like, that's it. that's the whole signature. iconic. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so. you've got a Performance Metric Identifier (PMID) and you slide it in via pmid. pmNameAll goes digging through the Performance Metrics Name Space (PMNS) and finds all the metric names that correspond to it β€” if any exist β€” and gives them back to you through nameset. she's thorough like that. πŸ‘‘

okay now listen close because this part is IMPORTANT:

The resulting list of pointers nameset and the values (the relative names) that those pointers reference will have been allocated by pmNameAll with a single call to malloc(3). so yeah, she mallocs it all in one go. 🫢 And it is the responsibility of the pmNameAll caller β€” that's you, bestie β€” to use free(nameset) to release the space when it is no longer required. don't ghost her after she did all that work. 😭

If there are no errors, pmNameAll returns the number of names in nameset. yes queen, tell us how many. πŸ”₯

For many examples of a PMNS, there will be a 1:1 mapping between a name and a PMID. and under those circumstances, pmNameID(3) provides a slightly simpler interface in the absence of duplicate names for a particular PMID. so if you know it's a one-to-one situation, pmNameID(3) is the low-effort, high-reward option. iykyk πŸ’œ


πŸ’€ DIAGNOSTICS πŸ’€

  • PM_ERR_NOPMNS β€” Failed to access a PMNS for operation. note that if the application hasn't a priori called pmLoadNameSpace(3) and wants to use the distributed PMNS, then a call to pmNameAll must be made after the creation of a context (see pmNewContext(3)). order matters, babes, don't skip steps πŸ™ˆ
  • PM_ERR_PMID β€” pmid does not correspond to a defined PMID in the PMNS. she looked. she found nothing. it's giving nonexistent. πŸ’€
  • PM_ERR_* β€” Other diagnostics are for protocol failures when accessing the distributed PMNS. network said no. 🌧️

πŸ” SEE ALSO πŸ”

PMAPI(3), pmGetChildren(3), pmGetChildrenStatus(3), pmGetConfig(3), pmLoadASCIINameSpace(3), pmLoadNameSpace(3), pmLookupName(3), pmNameID(3), pmNewContext(3), pcp.conf(5), pcp.env(5) and PMNS(5).

the whole friend group, fr fr. go read them too, they're all slaying in their own way 🌈⭐


mwah πŸ’‹ this page comes to you from Performance Co-Pilot (PCP) β€” that's the source and the version, periodt β€” and it lives in section 3, the library functions manual. go forth and translate those PMIDs, bestie. you're gonna eat. πŸ“πŸ§š

πŸ“¦ where this page comes from