From 834193484439acd6056a891e9b2df5992a370088 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 22 Mar 2011 16:36:13 +0100 Subject: include: reorganize headers file to include/osmocom/[gsm|core] This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso --- include/osmocom/core/statistics.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/osmocom/core/statistics.h (limited to 'include/osmocom/core/statistics.h') diff --git a/include/osmocom/core/statistics.h b/include/osmocom/core/statistics.h new file mode 100644 index 00000000..1d56054a --- /dev/null +++ b/include/osmocom/core/statistics.h @@ -0,0 +1,31 @@ +#ifndef _STATISTICS_H +#define _STATISTICS_H + +struct counter { + struct llist_head list; + const char *name; + const char *description; + unsigned long value; +}; + +static inline void counter_inc(struct counter *ctr) +{ + ctr->value++; +} + +static inline unsigned long counter_get(struct counter *ctr) +{ + return ctr->value; +} + +static inline void counter_reset(struct counter *ctr) +{ + ctr->value = 0; +} + +struct counter *counter_alloc(const char *name); +void counter_free(struct counter *ctr); + +int counters_for_each(int (*handle_counter)(struct counter *, void *), void *data); + +#endif /* _STATISTICS_H */ -- cgit v1.2.3