NNG_STAT_UNIT(3)

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

πŸ’… NNG_STAT_UNIT(3) β€” the nng_stat_unit situation

okay bestie come CLOSE, this is from the NNG Reference Manual and it's genuinely so simple it's giving ✨ one-function wonder ✨


🌸 NAME 🌸

nng_stat_unit β€” get statistic unit. that's it. that's the whole job. she returns a unit, you say thank you πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <nng/nng.h>

typedef struct nng_stat nng_stat;

enum {
        NNG_UNIT_NONE,
        NNG_UNIT_BYTES,
        NNG_UNIT_MESSAGES,
        NNG_UNIT_MILLIS,
        NNG_UNIT_EVENTS
};

int nng_stat_unit(nng_stat *stat);

πŸ¦‹ DESCRIPTION πŸ¦‹

so nng_stat_unit() returns the unit of quantity measured by the statistic stat. like, what IS this number even counting?? she'll tell you πŸ’…

the returned value is gonna be one of these, no cap:

  • NNG_UNIT_NONE β€” there are no particular units measured. HOWEVER (and this is the tea β˜•) sometimes there ARE units, it's just that the type of unit is obvious from the name of the statistic β€” go peek at nng_stat_name() and you'll get it, iykyk.
  • NNG_UNIT_BYTES β€” the statistic is a count of bytes. iconic. data go brrr ✨
  • NNG_UNIT_MESSAGES β€” the statistic is a count of messages. typically, one message corresponds to a single nng_msg structure. one msg = one message, the math is mathing 🫢
  • NNG_UNIT_MILLIS β€” the statistic is a count of milliseconds.
  • NNG_STAT_EVENTS β€” the statistic is a count of some other type of event. (yes bestie, that's exactly how she's spelled in here, don't come for me 😭)

ngl this next bit matters: for statistics that are neither NNG_STAT_COUNTER nor NNG_STAT_LEVEL type (see nng_stat_type() for that whole vibe), the unit will generally be NNG_UNIT_NONE. periodt.

✨ Tip ✨ normally rates can be calculated for NNG_STAT_COUNTER values for any of these units, but for NNG_UNIT_MILLIS rate calculations are generally meaningless. so like. don't. πŸ™ˆ

⭐ RETURN VALUES ⭐

the units measured by stat. that's the return. that's her whole personality πŸ’–


πŸ’€ ERRORS πŸ’€

None. not a single one. she cannot fail. main character energy fr fr πŸ‘‘


🌈 SEE ALSO 🌈

libnng(3), nng_stats_get(3), nng_stat_name(3), nng_stat_type(3), nng_stat_value(3), nng_msg(5), nng_stat(5), nng(7)


okay that's the whole page bestie, go forth and check ur units πŸ’…βœ¨ this was NNG_STAT_UNIT(3) from the NNG Reference Manual, dated 2026-06-30 β€” slay, mwah πŸŽ€πŸ’œ

πŸ“¦ where this page comes from