Change in libosmocore[master]: Print error message if application fails to call rate_ctr_init()

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
Fri May 10 07:09:52 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13919 )

Change subject: Print error message if application fails to call rate_ctr_init()
......................................................................

Print error message if application fails to call rate_ctr_init()

Change-Id: Ie8093b66b7e27cf863d2558fe21b2c6e0f3fcdfd
Closes: OS#3580
---
M src/rate_ctr.c
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 026670b..99ec523 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -69,7 +69,7 @@
 #include <osmocom/core/logging.h>
 
 static LLIST_HEAD(rate_ctr_groups);
-
+static struct osmo_timer_list rate_ctr_timer;
 static void *tall_rate_ctr_ctx;
 
 
@@ -217,6 +217,10 @@
 	unsigned int size;
 	struct rate_ctr_group *group;
 
+	if (!osmo_timer_pending(&rate_ctr_timer))
+		LOGP(DLGLOBAL, LOGL_ERROR, "your program appears to use libosmocore rate_ctr "
+			"without calling rate_ctr_init() at start-up. Rate counters won't work!\n");
+
 	if (rate_ctr_get_group_by_name_idx(desc->group_name_prefix, idx)) {
 		unsigned int new_idx = rate_ctr_get_unused_name_idx(desc->group_name_prefix);
 		LOGP(DLGLOBAL, LOGL_ERROR, "counter group '%s' already exists for index %u,"
@@ -294,7 +298,6 @@
 		ctr->intv[intv+1].rate += ctr->intv[intv].rate;
 }
 
-static struct osmo_timer_list rate_ctr_timer;
 static uint64_t timer_ticks;
 
 /* The one-second interval has expired */

-- 
To view, visit https://gerrit.osmocom.org/13919
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8093b66b7e27cf863d2558fe21b2c6e0f3fcdfd
Gerrit-Change-Number: 13919
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190510/79e907d2/attachment.htm>


More information about the gerrit-log mailing list