aboutsummaryrefslogtreecommitdiff
path: root/src/core/stats.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-10-13 07:06:46 -0700
committerGarrett D'Amore <garrett@damore.org>2024-10-13 07:06:46 -0700
commit6d0143d66feec9f9f8418a8758807c503eea87e1 (patch)
treef70c74371a0dfb134c60234bc06cd3c4a97574cf /src/core/stats.h
parent43d947ad8e840e0ac31dcbf4151aae94fbd0782f (diff)
downloadnng-6d0143d66feec9f9f8418a8758807c503eea87e1.tar.gz
nng-6d0143d66feec9f9f8418a8758807c503eea87e1.tar.bz2
nng-6d0143d66feec9f9f8418a8758807c503eea87e1.zip
stats: Reduce the need for NNG_ENABLE_STATS checks everywhere.
Diffstat (limited to 'src/core/stats.h')
-rw-r--r--src/core/stats.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/stats.h b/src/core/stats.h
index e80f18df..ff4db25c 100644
--- a/src/core/stats.h
+++ b/src/core/stats.h
@@ -36,21 +36,23 @@ typedef enum nng_unit_enum nni_stat_unit;
// avoid having to spend dereference costs or (worse) to have to include
// extra conditionals on hot code paths.
struct nni_stat_item {
+#ifdef NNG_ENABLE_STATS
nni_list_node si_node; // list node, framework use only
nni_list si_children; // children, framework use only
const nni_stat_info *si_info; // statistic description
union {
uint64_t sv_number;
nni_atomic_u64 sv_atomic;
- char * sv_string;
+ char *sv_string;
bool sv_bool;
int sv_id;
} si_u;
+#endif
};
struct nni_stat_info {
- const char * si_name; // name of statistic
- const char * si_desc; // description of statistic (English)
+ const char *si_name; // name of statistic
+ const char *si_desc; // description of statistic (English)
nni_stat_type si_type; // statistic type, e.g. NNG_STAT_LEVEL
nni_stat_unit si_unit; // statistic unit, e.g. NNG_UNIT_MILLIS
nni_stat_update si_update; // update function (can be NULL)