NNG_STAT_UNIT(3)
π 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 atnng_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 singlenng_msgstructure. 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 forNNG_STAT_COUNTERvalues for any of these units, but forNNG_UNIT_MILLISrate 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
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms