[MERGED] libosmocore[master]: counters: add osmo_counters_count() returns the amount of co...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Dec 5 16:05:30 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: counters: add osmo_counters_count() returns the amount of counters
......................................................................


counters: add osmo_counters_count() returns the amount of counters

Change-Id: I9068231d71876e06d27ee67a688d7fb611ac3a1b
---
M include/osmocom/core/counter.h
M src/counter.c
2 files changed, 9 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/core/counter.h b/include/osmocom/core/counter.h
index e692f7e..259f1ed 100644
--- a/include/osmocom/core/counter.h
+++ b/include/osmocom/core/counter.h
@@ -44,6 +44,8 @@
 
 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 0fa84c8..0fa3166 100644
--- a/src/counter.c
+++ b/src/counter.c
@@ -77,6 +77,13 @@
 	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 */

-- 
To view, visit https://gerrit.osmocom.org/5189
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9068231d71876e06d27ee67a688d7fb611ac3a1b
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list