MMV_LOOKUP_VALUE_DESC(3)

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

✨ NAME ✨

mmv_lookup_value_desc β€” bestie, this is the one that goes and finds a value in the Memory Mapped Value file πŸ’–


πŸ’… C SYNOPSIS πŸ’…

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

pmAtomValue *mmv_lookup_value_desc(void *addr, const char *metric,
                                   const char *inst);

cc ... -lpcp_mmv -lpcp

okay so literally just those two includes and you're in 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so mmv_lookup_value_desc is out here searching for the value of the instance identified by the external instance name inst of the metric metric, inside the MMV(5) file. no cap, that's the whole mission πŸŽ€

and addr? that's the address you got back from mmv_stats_init(). don't lose it bestie, you need it here πŸ‘‘

The pointer it hands back points to a pmAtomValue union, and that union is defined like this, exactly like this:

typedef union {
    __int32_t   l;      /* 32-bit signed */
    __uint32_t  ul;     /* 32-bit unsigned */
    __int64_t   ll;     /* 64-bit signed */
    __uint64_t  ull;    /* 64-bit unsigned */
    float       f;      /* 32-bit floating point */
    double      d;      /* 64-bit floating point */
    char         *cp;   /* char ptr */
 pmValueBlock *vbp;  /* pmValueBlock ptr */
} pmAtomValue;

🌸 little side quest note: MMV string values should be set using either of the mmv_set_string or mmv_set_strlen routines. pick one, you're iconic either way πŸ’–


⭐ RETURNS ⭐

On success? It returns the address inside of the memory mapped region. slay.

On failure? It returns NULL. absolutely devastating, check your inputs fr fr 😭


🌈 SEE ALSO 🌈


not me ending every page with the same energy but okay πŸ’€

this was brought to you by Performance Co-Pilot, page MMV_LOOKUP_VALUE_DESC(3), and yeah it's giving main character energy, periodt πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from