Add 'libosmocore/' from commit '045cc22baeb7f12dcb0022b79a1984d86e922870'

git-subtree-dir: libosmocore
git-subtree-mainline: e164d29e7f6c86d1f6f047bbf58159e46a11425f
git-subtree-split: 045cc22baeb7f12dcb0022b79a1984d86e922870
diff --git a/libosmocore/include/osmocore/statistics.h b/libosmocore/include/osmocore/statistics.h
new file mode 100644
index 0000000..1d56054
--- /dev/null
+++ b/libosmocore/include/osmocore/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 */