summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/core/counter.h2
-rw-r--r--src/counter.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/include/osmocom/core/counter.h b/include/osmocom/core/counter.h
index e692f7e6..259f1edf 100644
--- a/include/osmocom/core/counter.h
+++ b/include/osmocom/core/counter.h
@@ -44,6 +44,8 @@ void osmo_counter_free(struct osmo_counter *ctr);
int osmo_counters_for_each(int (*handle_counter)(struct osmo_counter *, void *), void *data);
+int osmo_counters_count();
+
struct osmo_counter *osmo_counter_get_by_name(const char *name);
int osmo_counter_difference(struct osmo_counter *ctr);
diff --git a/src/counter.c b/src/counter.c
index 0fa84c8f..0fa31661 100644
--- a/src/counter.c
+++ b/src/counter.c
@@ -77,6 +77,13 @@ int osmo_counters_for_each(int (*handle_counter)(struct osmo_counter *, void *),
return rc;
}
+/*! Counts the registered counter
+ * \returns amount of counters */
+int osmo_counters_count()
+{
+ return llist_count(&counters);
+}
+
/*! Find a counter by its name.
* \param[in] name Name used to look-up/search counter
* \returns Counter on success; NULL if not found */