DOKK / manpages / debian 12 / libpcp-mmv1-dev / mmv_set_value.3.en
MMV_SET_VALUE(3) Library Functions Manual MMV_SET_VALUE(3)

mmv_set, mmv_set_value, mmv_set_atomvalue - set a value in a Memory Mapped Value file

#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);

cc ... -lpcp_mmv -lpcp

mmv_set, mmv_set_value and mmv_set_atomvalue provide convenient ways of directly setting a value for a metric av previously returned by the mmv_lookup_value_desc(3) interface. addr is the address returned from mmv_stats_init(3).

These interfaces are typically used with instantaneous and discrete metrics. Refer to mmv_inc_value(3) for a mechanism suited to monotonic increasing counter metrics.

With mmv_set and mmv_set_atomvalue the value provided via the inc pointer must match the type of the metric and will be used as the new value of the metric.

In the case of mmv_set and mmv_set_value, the pointer value val is internally cast to match the type of the metric and then used as the value for the metric.

mmv_inc_value(3), mmv_stats_init(3), mmv_lookup_value_desc(3) and mmv(5).

Performance Co-Pilot