PMNAMEID(3)

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

πŸ’– PMNAMEID(3) πŸ’–

Library Functions Manual Β· Performance Co-Pilot β€” yes bestie, we're in the PMNAMEID(3) section, it's a C library function moment πŸŽ€


✨ NAME ✨

pmNameID β€” the glow-up where a PMID turns into a performance metric name πŸ¦‹


✨ C SYNOPSIS ✨

#include <pcp/pmapi.h>

int pmNameID(pmID pmid, char **name);

cc ... -lpcp

no cap, that's the whole signature, she's short and she serves πŸ’…


✨ DESCRIPTION ✨

okay so. you hand pmNameID a Performance Metric Identifier (a PMID) through pmid, and she goes off to find the matching metric name β€” if there even is one β€” inside the Performance Metrics Name Space (aka the PMNS), and gives it back to you through name. literally that's her whole job, and she eats every time πŸ”₯

⚠️ and here's the tea, bestie: if the PMNS has multiple names pointing at the PMID you asked for, she'll return one of them via name β€” but there is genuinely no way to determine which of the duplicate names you're gonna get. it's giving mystery box 🎁. if you need all the names, go see pmNameAll(3) instead.

As of Version 3.10.3 of PCP, duplicate names for the same PMID are allowed in the PMNS, so using pmNameAll(3) is recommended over pmNameID. (like... the newer flex exists, use the newer flex, iykyk) ✨

name is a null-byte terminated string, and it's allocated by pmNameID using malloc(3) β€” so it's on you, the caller to call free(3) and release that storage once you don't need the value anymore. don't leave her hanging in memory, that's not the vibe πŸ™ˆ

In the absence of errors, pmNameID returns zero. πŸ’š (zero = we slayed, zero = no problems)


✨ DIAGNOSTICS ✨

  • PM_ERR_NOPMNS β€” Failed to access a PMNS for operation. heads up though: if the application hasn't a priori called pmLoadNameSpace(3) and wants to use the distributed PMNS, then a call to pmNameID must be made after the creation of a context (see pmNewContext(3)). order matters, bestie, context first, always 🫢
  • PM_ERR_PMID β€” pmid does not correspond to a defined PMID in the PMNS. she looked. she found nothing. it's not in the PMNS, periodt πŸ’€
  • PM_ERR_* β€” Other diagnostics are for protocol failures when accessing the distributed PMNS. network said "not today" 😭

✨ SEE ALSO ✨

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

go read them, they're all icons πŸ‘‘


🌸 okay that's the whole page, you understood it, I'm so proud of you, mwah 🌸

This lil masterpiece comes to you courtesy of Performance Co-Pilot (that's the PCP girlies πŸ’œ), and the page itself is PMNAMEID(3). bye bestie, go free(3) your strings πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from