[MERGED] osmo-bsc[master]: Add stat items for the BTS's channel load average and T3122.

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
Mon Feb 5 22:36:54 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Add stat items for the BTS's channel load average and T3122.
......................................................................


Add stat items for the BTS's channel load average and T3122.

In addition to logging the current values of a BTS's channel load
average and T3122 override, maintain stat items for these values.
This allows for plotting these values over time, for instance.

These values show up in the VTY under 'show stats' like this:

base transceiver station:
 Channel load average.:       25 %
 T3122 IMMEDIATE ASSIGNMENT REJECT wait indicator.: 32 s

Change-Id: Icace0176e8b1d23d7c7b4816f7c67c65312844fa
Suggested-by: laforge
---
M include/osmocom/bsc/gsm_data.h
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/chan_alloc.c
M src/libcommon/gsm_data_shared.c
4 files changed, 28 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 25dee78..9a35ca9 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -10,6 +10,7 @@
 #include <osmocom/core/rate_ctr.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/stats.h>
+#include <osmocom/core/stat_item.h>
 
 #include <osmocom/crypt/auth.h>
 
@@ -177,6 +178,11 @@
 };
 
 enum {
+	BTS_STAT_CHAN_LOAD_AVERAGE,
+	BTS_STAT_T3122,
+};
+
+enum {
 	BSC_CTR_HANDOVER_ATTEMPTED,
 	BSC_CTR_HANDOVER_NO_CHANNEL,
 	BSC_CTR_HANDOVER_TIMEOUT,
diff --git a/include/osmocom/bsc/gsm_data_shared.h b/include/osmocom/bsc/gsm_data_shared.h
index 7a650fe..e3e1389 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -805,6 +805,7 @@
 	struct pcu_sock_state *pcu_state;
 
 	struct rate_ctr_group *bts_ctrs;
+	struct osmo_stat_item_group *bts_statg;
 
 	struct handover_cfg *ho;
 
diff --git a/src/libbsc/chan_alloc.c b/src/libbsc/chan_alloc.c
index 5e2c0ee..500ad59 100644
--- a/src/libbsc/chan_alloc.c
+++ b/src/libbsc/chan_alloc.c
@@ -656,6 +656,8 @@
 	load = ((used / total) * 100);
 	LOGP(DRLL, LOGL_DEBUG, "(bts=%d) channel load average is %lu.%.2lu%%\n",
 	     bts->nr, (load & 0xffffff00) >> 8, (load & 0xff) / 10);
+	osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_LOAD_AVERAGE],
+			   (load & 0xffffff00) >> 8);
 
 	/* Calculate new T3122 wait indicator. */
 	wait_ind = ((used / total) * max_wait_ind);
@@ -667,4 +669,5 @@
 
 	LOGP(DRLL, LOGL_DEBUG, "(bts=%d) T3122 wait indicator set to %lu seconds\n", bts->nr, wait_ind);
 	bts->T3122 = (uint8_t)wait_ind;
+	osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_T3122], wait_ind);
 }
diff --git a/src/libcommon/gsm_data_shared.c b/src/libcommon/gsm_data_shared.c
index 3afc67e..57bf77d 100644
--- a/src/libcommon/gsm_data_shared.c
+++ b/src/libcommon/gsm_data_shared.c
@@ -30,10 +30,24 @@
 #include <osmocom/core/talloc.h>
 #include <osmocom/gsm/gsm_utils.h>
 #include <osmocom/gsm/abis_nm.h>
-#include <osmocom/core/statistics.h>
+#include <osmocom/core/counter.h>
+#include <osmocom/core/stats.h>
 
 #include <osmocom/bsc/gsm_data.h>
 #include <osmocom/bsc/handover_cfg.h>
+
+static const struct osmo_stat_item_desc bts_stat_desc[] = {
+	{ "chanloadavg", "Channel load average.", "%", 16, 0 },
+	{ "T3122", "T3122 IMMEDIATE ASSIGNMENT REJECT wait indicator.", "s", 16, GSM_T3122_DEFAULT },
+};
+
+static const struct osmo_stat_item_group_desc bts_statg_desc = {
+	.group_name_prefix = "bts",
+	.group_description = "base transceiver station",
+	.class_id = OSMO_STATS_CLASS_GLOBAL,
+	.num_items = ARRAY_SIZE(bts_stat_desc),
+	.item_desc = bts_stat_desc,
+};
 
 void gsm_abis_mo_reset(struct gsm_abis_mo *mo)
 {
@@ -353,11 +367,13 @@
 		talloc_free(bts);
 		return NULL;
 	}
+	bts->bts_statg = osmo_stat_item_group_alloc(bts, &bts_statg_desc, 0);
 
 	/* create our primary TRX */
 	bts->c0 = gsm_bts_trx_alloc(bts);
 	if (!bts->c0) {
-		talloc_free(bts->bts_ctrs);
+		rate_ctr_group_free(bts->bts_ctrs);
+		osmo_stat_item_group_free(bts->bts_statg);
 		talloc_free(bts);
 		return NULL;
 	}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icace0176e8b1d23d7c7b4816f7c67c65312844fa
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list