PMIPUTVALUE(3)

πŸ’– pmiPutValue β€” the add a value for a metric-instance pair moment πŸ’–

okay bestie, this one's from the Performance Co-Pilot library functions manual, section 3, and it's genuinely so useful. let's get into it 🫢


✨ NAME ✨

pmiPutValue β€” add a value for a metric-instance pair πŸ’…


🌸 C SYNOPSIS 🌸

#include <pcp/pmapi.h>
#include <pcp/import.h>

int pmiPutValue(const char *name, const char *instance,
                const char *value);

cc ... -lpcp_import -lpcp

πŸŽ€ Perl SYNOPSIS πŸŽ€

use PCP::LogImport;

pmiPutValue($name, $instance, $value);

πŸ¦‹ Python SYNOPSIS πŸ¦‹

from pcp import pmi

log.pmiPutValue(name, instance, value)

πŸ‘‘ DESCRIPTION πŸ‘‘

so, like, as part of the Performance Co-Pilot Log Import API (peep LOGIMPORT(3) for the full lore), pmiPutValue adds a single value to the current output record for a given metric and instance. one value. that's the whole job. iconic. ✨

the metric's name should match one you already defined earlier in a call to pmiAddMetric(3). no defining it later, bestie, it has to exist first. πŸ’€

now for singular metrics β€” those lil guys defined with an instance domain of PM_INDOM_NULL β€” the instance should be NULL or an empty string. periodt. otherwise, instance should match the name of an instance you defined earlier in a call to pmiAddInstance(3) for that metric's instance domain. so yes, the instance has to already exist too. πŸ™ˆ

and the value? it should be in a format consistent with the metric's type as defined in the call to pmiAddMetric(3). match the vibe of the type, basically. 🎯

⚠️ heads up bestie: no data will be written until pmiWrite(3) is called. none. zero. it just sits there. 😭

so because of that, multiple calls to pmiPutValue or pmiPutValueHandle(3) are typically used to accumulate data values for several metric-instance pairs before calling pmiWrite(3). stack 'em up, then flush. that's the flow. 🫢


πŸ’œ DIAGNOSTICS πŸ’œ

pmiPutValue returns zero on success πŸŽ‰ β€” otherwise it returns a negative value that can be turned into an error message by calling pmiErrStr(3). so if you get a negative, go ask pmiErrStr(3) what's up. it'll tell you. πŸ’…


🌈 SEE ALSO 🌈

LOGIMPORT(3), pmiAddInstance(3), pmiAddMetric(3), pmiErrStr(3), pmiPutResult(3), pmiPutValueHandle(3), pmiPutText(3), pmiPutLabel(3) and pmiWrite(3).


okay that's the whole page, bestie, you ate that πŸ“ this was Performance Co-Pilot, PMIPUTVALUE(3) β€” go forth and put some values πŸ’–βœ¨

πŸ“¦ where this page comes from