Change in osmo-pcu[master]: Add stats: pcu.bts.N.pdch.available/occupied

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/.

osmith gerrit-no-reply at lists.osmocom.org
Mon Sep 6 09:11:48 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25333 )

Change subject: Add stats: pcu.bts.N.pdch.available/occupied
......................................................................

Add stats: pcu.bts.N.pdch.available/occupied

Count available PDCHs (3GPP TS 52.402 § B.2.1.38) as well as occupied
PDCHs (§ B.2.1.42-44).

Related: SYS#4878
Change-Id: I74760a68ee055510a79e80854ec7bf1521669119
---
M src/bts.cpp
M src/bts.h
M src/pdch.cpp
3 files changed, 24 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/bts.cpp b/src/bts.cpp
index 8ccbee9..beb626d 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -199,6 +199,10 @@
 static const struct osmo_stat_item_desc bts_stat_item_description[] = {
 	{ "ms.present",		"MS Present           ",
 		OSMO_STAT_ITEM_NO_UNIT, 4, 0},
+	{ "pdch.available",	"PDCH available       ",
+		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
+	{ "pdch.occupied",	"PDCH occupied        ",
+		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
 };
 
 static const struct osmo_stat_item_group_desc bts_statg_desc = {
diff --git a/src/bts.h b/src/bts.h
index 5e45527..a6e7150 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -182,6 +182,8 @@
 
 enum {
 	STAT_MS_PRESENT,
+	STAT_PDCH_AVAILABLE,
+	STAT_PDCH_OCCUPIED,
 };
 
 /* RACH.ind parameters (to be parsed) */
@@ -346,6 +348,10 @@
 	osmo_stat_item_set(item, val + inc);
 }
 
+#define bts_stat_item_inc(bts, stat_id) bts_stat_item_add(bts, stat_id, 1)
+
+#define bts_stat_item_dec(bts, stat_id) bts_stat_item_add(bts, stat_id, -1)
+
 struct gprs_rlcmac_bts *bts_alloc(struct gprs_pcu *pcu, uint8_t bts_nr);
 
 struct gprs_rlcmac_sba *bts_alloc_sba(struct gprs_rlcmac_bts *bts, uint8_t ta);
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 49f9eb6..e213c28 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -150,6 +150,7 @@
 	this->ulc = pdch_ulc_alloc(this, trx->bts);
 
 	m_is_enabled = 1;
+	bts_stat_item_inc(trx->bts, STAT_PDCH_AVAILABLE);
 }
 
 void gprs_rlcmac_pdch::disable()
@@ -158,6 +159,7 @@
 	this->free_resources();
 
 	m_is_enabled = 0;
+	bts_stat_item_dec(trx->bts, STAT_PDCH_AVAILABLE);
 }
 
 void gprs_rlcmac_pdch::free_resources()
@@ -1043,6 +1045,12 @@
 			"%s has not been detached, overwriting it\n",
 			m_tbfs[tbf->direction][tbf->tfi()]->name());
 
+	/* Count PDCHs with at least one TBF as "occupied", as in
+	 * 3GPP TS 52.402 § B.2.1.42-44. So if transitioning from 0 TBFs in
+	 * this PDCH to 1, increase the counter by 1. */
+	if (m_num_tbfs[GPRS_RLCMAC_UL_TBF] + m_num_tbfs[GPRS_RLCMAC_DL_TBF] == 0)
+		bts_stat_item_inc(trx->bts, STAT_PDCH_OCCUPIED);
+
 	m_num_tbfs[tbf->direction] += 1;
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
 		ul_tbf = as_ul_tbf(tbf);
@@ -1063,6 +1071,12 @@
 
 	OSMO_ASSERT(m_num_tbfs[tbf->direction] > 0);
 
+	/* Count PDCHs with at least one TBF as "occupied", as in
+	 * 3GPP TS 52.402 § B.2.1.42-44. So if transitioning from 1 TBFs in
+	 * this PDCH to 0, decrease the counter by 1. */
+	if (m_num_tbfs[GPRS_RLCMAC_UL_TBF] + m_num_tbfs[GPRS_RLCMAC_DL_TBF] == 1)
+		bts_stat_item_dec(trx->bts, STAT_PDCH_OCCUPIED);
+
 	m_num_tbfs[tbf->direction] -= 1;
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
 		ul_tbf = as_ul_tbf(tbf);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/25333
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I74760a68ee055510a79e80854ec7bf1521669119
Gerrit-Change-Number: 25333
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210906/9e39fe0b/attachment.htm>


More information about the gerrit-log mailing list