MMV_INC_VALUE(3)

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

πŸ’– MMV_INC_VALUE(3) β€” Library Functions Manual πŸ’–

okay bestie, sit down, hydrate, and let me tell you about mmv_inc, mmv_inc_value, and mmv_inc_atomvalue β€” the lil trio that updates a value in a Memory Mapped Value file. yes, that's the whole vibe. and no, we're not being normal about it. πŸ’…


✨ NAME ✨

mmv_inc, mmv_inc_value, mmv_inc_atomvalue β€” update a value in a Memory Mapped Value file πŸ¦‹

like. the entire job. update a value. in a Memory Mapped Value file. iconic behaviour, honestly.


🌸 C SYNOPSIS 🌸

first, the summoning circle (a.k.a. the includes):

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

then the actual queens:

void mmv_inc_value(void *addr, pmAtomValue *av, double inc);
void mmv_inc_atomvalue(void *addr, pmAtomValue *av, pmAtomValue *inc);

and don't forget to link the girlies in, or she will not compile, and you will cry:

cc ... -lpcp_mmv -lpcp

πŸ’œ DESCRIPTION πŸ’œ

so mmv_inc_value and mmv_inc_atomvalue are literally just ✨convenient✨ little shortcuts for updating a metric av that you already got handed to you earlier by the mmv_lookup_value_desc(3) interface. no cap. and addr? that's the address that came back from mmv_stats_init(3). she's the address, bestie, respect her. 🫢

now β€” these interfaces are most commonly used with counter type metrics. if you're out here doing instantaneous or discrete metrics instead, go read mmv_set_value(3) because that's the mechanism built for that job. different girl, different skillset, okay? πŸ’…

πŸŽ€ the two flavours πŸŽ€

  • mmv_inc_atomvalue β€” with this one, the value you pass through the inc pointer must match the type of the metric. must. match. it gets added to the previous value of the metric. periodt.
  • mmv_inc_value β€” with this one, the value of inc gets internally cast to match the type of the metric, and then it's added to the previous value of the metric. she does the type-wrangling for you. main character energy, honestly. 😭
lowkey important: type matching is not a suggestion, it's the law. mmv_inc_atomvalue does not cast for you. only mmv_inc_value does. iykyk. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, in order, fr fr:


and that's the tea, bestie πŸ“ go forth and increment responsibly. this page comes to you courtesy of Performance Co-Pilot β€” MMV_INC_VALUE(3) β€” mwah, love u, bye πŸ‘‘βœ¨πŸ§šπŸ’–

πŸ“¦ where this page comes from