aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-09-02 12:23:58 +0200
committerosmith <osmith@sysmocom.de>2021-09-06 09:11:47 +0000
commit35d51ca4e3ad9bf2d99444244866a7f46cb5d9c2 (patch)
tree8b66b7f0d144d59ad9a0125670fce76904ba028f
parent1d663d92772af3135693bb8b924bfc5c0ce7b932 (diff)
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
-rw-r--r--src/bts.cpp4
-rw-r--r--src/bts.h6
-rw-r--r--src/pdch.cpp14
3 files changed, 24 insertions, 0 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 8ccbee98..beb626d5 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -199,6 +199,10 @@ static const struct rate_ctr_group_desc bts_ctrg_desc = {
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 5e45527c..a6e71500 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -182,6 +182,8 @@ enum {
enum {
STAT_MS_PRESENT,
+ STAT_PDCH_AVAILABLE,
+ STAT_PDCH_OCCUPIED,
};
/* RACH.ind parameters (to be parsed) */
@@ -346,6 +348,10 @@ static inline void bts_stat_item_add(struct gprs_rlcmac_bts *bts, unsigned int s
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 49f9eb62..e213c28c 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -150,6 +150,7 @@ void gprs_rlcmac_pdch::enable()
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 @@ void gprs_rlcmac_pdch::disable()
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 @@ void gprs_rlcmac_pdch::attach_tbf(gprs_rlcmac_tbf *tbf)
"%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 @@ void gprs_rlcmac_pdch::detach_tbf(gprs_rlcmac_tbf *tbf)
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);