MMV_SET_VALUE(3)
π 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 formmv_setandmmv_set_atomvalueβ thevalpointer 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
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-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.1.0-6.fc44 Β· 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 resolute: libpcp-mmv1-dev 7.1.1-1
- ubuntu stonking: libpcp-mmv1-dev 7.2.1-2build1
- Copyright (c) 2021 Red Hat
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms