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
This commit is contained in:
Oliver Smith 2021-09-02 12:23:58 +02:00 committed by osmith
parent 1d663d9277
commit 35d51ca4e3
3 changed files with 24 additions and 0 deletions

View File

@ -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 = {

View File

@ -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);

View File

@ -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);