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

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
Wed Sep 8 11:12:13 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25400 )


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

Add stats: pcu.bts.N.pdch.occupied.gprs/egprs

Add stats needed for performance measurements in
3GPP TS 52.402 § B.2.1.54-55.

Split m_num_tbfs to count GPRS and EGPRS TBFs separately. Move the code
that updates m_num_tbfs and sets the PDCH_OCCUPIED stats to a separate
function, as it's mostly the same in the TBF attach and detach.

Related: SYS#4878
Change-Id: I0c0a1121b4ae5f031782e7e63a0c28eb0b6c8b42
---
M src/bts.cpp
M src/bts.h
M src/pdch.cpp
M src/pdch.h
M src/tbf.h
5 files changed, 45 insertions(+), 19 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/00/25400/1

diff --git a/src/bts.cpp b/src/bts.cpp
index beb626d..c463606 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -201,7 +201,11 @@
 		OSMO_STAT_ITEM_NO_UNIT, 4, 0},
 	{ "pdch.available",	"PDCH available       ",
 		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
-	{ "pdch.occupied",	"PDCH occupied        ",
+	{ "pdch.occupied",	"PDCH occupied (all)  ",
+		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
+	{ "pdch.occupied.gprs",	"PDCH occupied (GPRS) ",
+		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
+	{ "pdch.occupied.egprs","PDCH occupied (EGPRS)",
 		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
 };
 
diff --git a/src/bts.h b/src/bts.h
index a6e7150..d9a86eb 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -184,6 +184,8 @@
 	STAT_MS_PRESENT,
 	STAT_PDCH_AVAILABLE,
 	STAT_PDCH_OCCUPIED,
+	STAT_PDCH_OCCUPIED_GPRS,
+	STAT_PDCH_OCCUPIED_EGPRS,
 };
 
 /* RACH.ind parameters (to be parsed) */
diff --git a/src/pdch.cpp b/src/pdch.cpp
index e213c28..8b40d7a 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -1036,6 +1036,31 @@
 	return tbf;
 }
 
+void gprs_rlcmac_pdch::num_tbfs_update(gprs_rlcmac_tbf *tbf, bool is_attach)
+{
+	enum tbf_type type =  tbf->is_egprs_enabled() ? TBF_TYPE_EGPRS : TBF_TYPE_GPRS;
+	int threshold = is_attach ? 0 : 1;
+	int inc = is_attach ? 1 : -1;
+	uint8_t ul_dl_gprs = m_num_tbfs[GPRS_RLCMAC_UL_TBF][TBF_TYPE_GPRS] +
+			     m_num_tbfs[GPRS_RLCMAC_DL_TBF][TBF_TYPE_GPRS];
+	uint8_t ul_dl_egprs = m_num_tbfs[GPRS_RLCMAC_UL_TBF][TBF_TYPE_EGPRS] +
+			      m_num_tbfs[GPRS_RLCMAC_DL_TBF][TBF_TYPE_EGPRS];
+
+	/* 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 (threshold)
+	 * TBFs in this PDCH to 1, increase the counter by 1 (inc). */
+	if (ul_dl_gprs + ul_dl_egprs == threshold)
+		bts_stat_item_add(trx->bts, STAT_PDCH_OCCUPIED, inc);
+
+	/* Update occupied GPRS/EGPRS stats too (§ B.2.1.54-55) */
+	if (type == TBF_TYPE_GPRS && ul_dl_gprs == threshold)
+		bts_stat_item_add(trx->bts, STAT_PDCH_OCCUPIED_GPRS, inc);
+	else if (type == TBF_TYPE_EGPRS && ul_dl_egprs == threshold)
+		bts_stat_item_add(trx->bts, STAT_PDCH_OCCUPIED_EGPRS, inc);
+
+	m_num_tbfs[tbf->direction][type] += inc;
+}
+
 void gprs_rlcmac_pdch::attach_tbf(gprs_rlcmac_tbf *tbf)
 {
 	gprs_rlcmac_ul_tbf *ul_tbf;
@@ -1045,13 +1070,7 @@
 			"%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;
+	num_tbfs_update(tbf, 1);
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
 		ul_tbf = as_ul_tbf(tbf);
 		m_assigned_usf |= 1 << ul_tbf->m_usf[ts_no];
@@ -1061,7 +1080,7 @@
 
 	LOGPDCH(this, DRLCMAC, LOGL_INFO, "Attaching %s, %d TBFs, "
 		"USFs = %02x, TFIs = %08x.\n",
-		tbf->name(), m_num_tbfs[tbf->direction],
+		tbf->name(), num_tbfs(tbf->direction),
 		m_assigned_usf, m_assigned_tfi[tbf->direction]);
 }
 
@@ -1071,13 +1090,7 @@
 
 	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;
+	num_tbfs_update(tbf, 0);
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
 		ul_tbf = as_ul_tbf(tbf);
 		m_assigned_usf &= ~(1 << ul_tbf->m_usf[ts_no]);
@@ -1089,7 +1102,7 @@
 
 	LOGPDCH(this, DRLCMAC, LOGL_INFO, "Detaching %s, %d TBFs, "
 		"USFs = %02x, TFIs = %08x.\n",
-		tbf->name(), m_num_tbfs[tbf->direction],
+		tbf->name(), num_tbfs(tbf->direction),
 		m_assigned_usf, m_assigned_tfi[tbf->direction]);
 }
 
diff --git a/src/pdch.h b/src/pdch.h
index 00f0b9d..6243a61 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -145,9 +145,11 @@
 		enum gprs_rlcmac_tbf_direction dir);
 
 	void free_resources();
+
+	void num_tbfs_update(gprs_rlcmac_tbf *tbf, bool is_attach);
 #endif
 
-	uint8_t m_num_tbfs[2];
+	uint8_t m_num_tbfs[2][2]; /* by direction (UL/DL), type (GPRS/EGPRS) */
 	uint8_t m_num_reserved[2];
 	uint8_t m_assigned_usf; /* bit set */
 	uint32_t m_assigned_tfi[2]; /* bit set */
@@ -158,7 +160,7 @@
 
 inline unsigned gprs_rlcmac_pdch::num_tbfs(enum gprs_rlcmac_tbf_direction dir) const
 {
-	return m_num_tbfs[dir];
+	return m_num_tbfs[dir][TBF_TYPE_GPRS] + m_num_tbfs[dir][TBF_TYPE_EGPRS];
 }
 
 inline unsigned gprs_rlcmac_pdch::num_reserved(
diff --git a/src/tbf.h b/src/tbf.h
index 0932933..ebe1d95 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -86,6 +86,11 @@
 	TBF_CTR_EGPRS_DL_MCS9,
 };
 
+enum tbf_type {
+	TBF_TYPE_GPRS,
+	TBF_TYPE_EGPRS,
+};
+
 extern const struct rate_ctr_group_desc tbf_ctrg_desc;
 extern unsigned int next_tbf_ctr_group_id;
 

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0c0a1121b4ae5f031782e7e63a0c28eb0b6c8b42
Gerrit-Change-Number: 25400
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210908/b1cbe1e1/attachment.htm>


More information about the gerrit-log mailing list