MMV_SET_VALUE(3)

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

πŸ’– MMV_SET_VALUE(3) πŸ’–

okay bestie, so this is a page from the Library Functions Manual and it's literally about mmv_set, mmv_set_value and mmv_set_atomvalue β€” three lil functions that set a value in a Memory Mapped Value file. no cap. let's get into it 🫢


✨ NAME ✨

mmv_set, mmv_set_value, mmv_set_atomvalue β€” set a value in a Memory Mapped Value file πŸ’…


🌸 C SYNOPSIS 🌸

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

void mmv_set(void *addr, pmAtomValue *av, void *val);
void mmv_set_value(void *addr, pmAtomValue *av, double val);
void mmv_set_atomvalue(void *addr, pmAtomValue *av, pmAtomValue *val);

and to actually build the thing, you link it like this:

cc ... -lpcp_mmv -lpcp

πŸ¦‹ DESCRIPTION πŸ¦‹

so mmv_set, mmv_set_value and mmv_set_atomvalue are the convenient lil trio that let you directly set a value for a metric av β€” and av is that metric you already got back from the mmv_lookup_value_desc(3) interface. meanwhile addr is the address you got from mmv_stats_init(3). yep, that's the whole setup, iconic πŸ’œ

these interfaces are typically the ones you reach for with instantaneous and discrete metrics. if what you actually want is a mechanism suited to monotonic increasing counter metrics, go look at mmv_inc_value(3) instead β€” that's its whole thing πŸŽ€

with mmv_set and mmv_set_atomvalue, the value you hand over through the val pointer must match the type of the metric, and it'll be used as the new value of the metric. type mismatch? not it. πŸ™ˆ

in the case of mmv_set and mmv_set_value, the pointer val is internally cast to match the type of the metric, and then it gets used as the value for the metric. so it shapeshifts for you, main character energy fr fr ✨

ngl bestie, keep that type-matching rule in your head for mmv_set and mmv_set_atomvalue β€” the val pointer has to match the metric's type. no matching, no slay. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie πŸ’– this one comes from Performance Co-Pilot and it's the MMV_SET_VALUE(3) page β€” go set some values, you absolute legend 🌈⭐

πŸ“¦ where this page comes from