summaryrefslogtreecommitdiffstats
path: root/stats.h
diff options
context:
space:
mode:
Diffstat (limited to 'stats.h')
-rw-r--r--stats.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/stats.h b/stats.h
new file mode 100644
index 0000000..cf129b6
--- /dev/null
+++ b/stats.h
@@ -0,0 +1,17 @@
+#define STAT_APPLY(XX)\
+ XX(nfds_cnt)\
+ XX(nfds_sum)\
+ XX(nfds_max)\
+ XX(yield_cnt)
+
+
+#define STAT_STRUCT_FN(name) size_t name;
+struct {
+ STAT_APPLY(STAT_STRUCT_FN)
+} stats;
+
+
+#define STAT_PRINT_FN(name) printf ( #name ": %zu\n", stats. name);
+void report_stat () {
+ STAT_APPLY(STAT_PRINT_FN);
+}