aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/chan_alloc.c
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2020-05-06 23:17:49 +0300
committeripse <Alexander.Chemeris@gmail.com>2020-05-08 20:25:54 +0000
commitb091def16eb1044c5c87cdaa1569b8dff92eb3f1 (patch)
tree5efe49f5b08234b2679609203dec035f8a50c050 /src/osmo-bsc/chan_alloc.c
parent241f058aeb3b714239887d3961b0ddd6829f75c1 (diff)
stats: Report per channel type load to statsd counters.
Diffstat (limited to 'src/osmo-bsc/chan_alloc.c')
-rw-r--r--src/osmo-bsc/chan_alloc.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/osmo-bsc/chan_alloc.c b/src/osmo-bsc/chan_alloc.c
index ac246e0e7..b2fbac881 100644
--- a/src/osmo-bsc/chan_alloc.c
+++ b/src/osmo-bsc/chan_alloc.c
@@ -109,6 +109,53 @@ void network_chan_load(struct pchan_load *pl, struct gsm_network *net)
bts_chan_load(pl, bts);
}
+static void chan_load_stat_set(enum gsm_phys_chan_config pchan,
+ struct gsm_bts *bts,
+ struct load_counter *lc)
+{
+ switch (pchan) {
+ case GSM_PCHAN_NONE:
+ case GSM_PCHAN_CCCH:
+ case GSM_PCHAN_PDCH:
+ case GSM_PCHAN_UNKNOWN:
+ break;
+ case GSM_PCHAN_CCCH_SDCCH4:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_TOTAL], lc->total);
+ break;
+ case GSM_PCHAN_TCH_F:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_TOTAL], lc->total);
+ break;
+ case GSM_PCHAN_TCH_H:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_H_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_H_TOTAL], lc->total);
+ break;
+ case GSM_PCHAN_SDCCH8_SACCH8C:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_TOTAL], lc->total);
+ break;
+ case GSM_PCHAN_TCH_F_PDCH:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_PDCH_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_PDCH_TOTAL], lc->total);
+ break;
+ case GSM_PCHAN_CCCH_SDCCH4_CBCH:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_CBCH_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_CBCH_TOTAL], lc->total);
+ break;
+ case GSM_PCHAN_SDCCH8_SACCH8C_CBCH:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_CBCH_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_CBCH_TOTAL], lc->total);
+ break;
+ case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_TCH_H_PDCH_USED], lc->used);
+ osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_TCH_H_PDCH_TOTAL], lc->total);
+ break;
+ default:
+ LOG_BTS(bts, DRLL, LOGL_NOTICE, "Unknown channel type %d\n", pchan);
+ }
+}
+
/* Update T3122 wait indicator based on samples of BTS channel load. */
void
bts_update_t3122_chan_load(struct gsm_bts *bts)
@@ -133,6 +180,9 @@ bts_update_t3122_chan_load(struct gsm_bts *bts)
for (i = 0; i < ARRAY_SIZE(pl.pchan); i++) {
struct load_counter *lc = &pl.pchan[i];
+ /* Export channel load to stats gauges */
+ chan_load_stat_set(i, bts, lc);
+
/* Ignore samples too large for fixed-point calculations (shouldn't happen). */
if (lc->used > UINT16_MAX || lc->total > UINT16_MAX) {
LOG_BTS(bts, DRLL, LOGL_NOTICE, "numbers in channel load sample "