#pragma once
#include "common.hpp"
#include "hooks.hpp"
typedef uint64_t stat_t;
typedef struct {
stat_t num;
stat_t rx; ///< read upstream traffic w/o ssl overhead
stat_t tx;
stat_t stimes;
stat_t certs, cert_hits;
stat_t read_attempts, reads, read_data;
stat_t write_attempts, writes, wrote_data;
stat_t pool_allocs, pool_hits;
stat_t spool_allocs, spool_hits;
} stats_t;
extern stats_t stats;
const int stats_num = sizeof(stats)/sizeof(stat_t);
#define stats_inc(f) ++stats.f
#define stats_add(f, v) stats.f += (stat_t)(v)
#define stat_get(f) (&stats.f) ///< get ptr to some counter
#define stat_add(p, v) *(p) += (stat_t)(v) ///< increment value of counter ptr