PMIGETHANDLE(3)
π PMIGETHANDLE π
okay bestie, welcome to pmiGetHandle β a lil gem from the Performance Co-Pilot manual pages, section 3 (that's the library-calls girlies, iykyk). she's part of the Log Import squad and she's here to hand you a cute lil key β¨
πΈ NAME πΈ
pmiGetHandle β define a handle for a metric-instance pair π«Ά
β¨ C SYNOPSIS β¨
#include <pcp/pmapi.h>
#include <pcp/import.h>
int pmiGetHandle(const char *name, const char *instance);
cc ... -lpcp_import -lpcp
π Perl SYNOPSIS π
use PCP::LogImport;
$handle = pmiGetHandle($name, $instance);
π¦ Python SYNOPSIS π¦
from pcp import pmi
handle = log.pmiGetHandle(name, instance)
π DESCRIPTION π
so. this whole function lives inside the Performance Co-Pilot Log Import API (peep LOGIMPORT(3) for the full lore, bestie π). and what she does is iconic: pmiGetHandle makes you a handle for a given metric and instance. that handle is literally the return value of the pmiGetHandle call, and you get to reuse it later in your pmiPutValueHandle(3) calls. like, she gave you a VIP wristband and now you skip the line ποΈβ¨
the metric's name should match one you already defined earlier in a call to pmiAddMetric(3). don't just make up a name, she WILL notice π
now, about the instance situation:
- for singular metrics (the ones defined with an instance domain of
PM_INDOM_NULL), instance should beNULLor an empty string. that's it, that's the whole vibe π - otherwise, instance should match the name of an instance you defined earlier in a call to
pmiAddInstance(3)for the metric's instance domain.
and here's the why, because you deserve to know: when you pair this with pmiPutValueHandle(3), using handles gives you a performance improvement over the alternative β which is looking up a metric name and an instance name for every single data value you need for pmiPutValue(3). no cap, that's a glow-up for your loop π₯
π©Ί DIAGNOSTICS π©Ί
if things go sideways, pmiGetHandle returns a negative value π (not the cute kind). you can turn that sad lil number into an actual error message by calling pmiErrStr(3). always read the error bestie, she's trying to tell you something π
π SEE ALSO π
and that's the page, bestie π this whole thing comes to you courtesy of Performance Co-Pilot, filed under the PMIGETHANDLE() manual page β go forth, get your handles, and slay β¨ππ¦
π¦ 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
- 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 stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2010 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