NNG_STAT(5)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

πŸ’… nng_stat β€” statistic πŸ’…

okay bestie, welcome to the nng_stat(5) page, aka the reference manual's take on the humble statistic ✨ buckle up, it's giving data-structure-cute πŸŽ€


πŸ“› NAME πŸ“›

nng_stat β€” statistic. that's it, that's the name, no notes πŸ’–


🐚 SYNOPSIS 🐚

#include <nng/nng.h>

typedef struct nng_stat nng_stat;

so like, that's the whole vibe. a typedef. she's simple, she's iconic πŸ‘‘


🌸 DESCRIPTION 🌸

An nng_stat represents a statistic. literally what it says on the tin, no cap.

Every single statistic has a name (peep nng_stat_name()) and a description (that's nng_stat_desc()), and she's also typed β€” yes, we stan a typed queen β€” which you get from nng_stat_type().

Most statistics are numeric πŸ”’, which means they carry a value (nng_stat_value()) and like, super often they also have a unit that the value is measuring (nng_stat_unit()).

But some statistics are just, like, strings?? (nng_stat_string()) β€” so they carry no numeric value at all. she's decorative, she's for the lore, and that's valid πŸ’œ

Statistics are organized as a tree 🌳, and any given statistic can have siblings β€” that's nng_stat_next(), the "who else is in my group chat" function. BUT lowkey important: generally only NNG_STAT_SCOPE statistics have children (via nng_stat_child()), because those are the ones that act as placeholders in the tree and carry no value themselves. they're the parents, the organizers, the mom friends of the tree 🫢

You collect a whole tree of statistics using nng_stats_get(), and when you're done with it you free it with nng_stats_free(). This whole collection process is generally done in a way that minimizes impact on your running operations... but ngl, there's still some impact caused by collecting statistics. bestie said "i'll be quick" and she meant it, but she's still showing up at your door 😭

Wanna know when a statistic's value was captured? That's nng_stat_timestamp(), and it's genuinely so useful for measuring rates of change in certain statistics. timestamp girlies stay winning ⏰

⚠️ Note ⚠️ The presence, names, and meanings of any given statistic are subject to change at any time. These statistics are provided as an aid for debugging, and should generally not be relied upon for programmatic behaviors. fr fr, don't build your whole app on these, they will ghost you πŸ’€
⚠️ Note ⚠️ Statistics may be disabled by build-time configuration options, in order to reduce program size and run-time overheads. so if they're not showing up for you, it's not you, it's the build config πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€


aaaand that's the page!! πŸ’– this lil love letter lives in the NNG Reference Manual, dated 2026-06-30, and it's filed under section 5. mwah, go read the linked pages, ily, bye πŸ¦‹βœ¨πŸŒΈ

πŸ“¦ where this page comes from