diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2021-09-27 08:56:20 +0200 |
---|---|---|
committer | neels <nhofmeyr@sysmocom.de> | 2021-11-10 13:27:43 +0000 |
commit | 41f143827d4233963b3a1b5e6a98ea7efa0f0fe1 (patch) | |
tree | edb3f1f39cdad32d21792c841f1d0fcc0ede639c /src | |
parent | e0458c2e005de048ac2940875ee2e20ad497c891 (diff) |
implement all_allocated:{sdcch,tch} rate counters
Based on allAvailable{SDCCH,TCH}Allocated performance indicators, see
3GPP TS 52.402.
Related: SYS#4878
Related: Ib3997a827c9cc43d1361bb0cf3bfab9f6d91bf82 (osmo-ttcn3-hacks)
Change-Id: I8b06e435a224c8708cd6c67e97ee5413718fc1ed
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bsc/bsc_init.c | 23 | ||||
-rw-r--r-- | src/osmo-bsc/bsc_stats.c | 48 | ||||
-rw-r--r-- | src/osmo-bsc/bts.c | 29 | ||||
-rw-r--r-- | src/osmo-bsc/lchan_fsm.c | 5 | ||||
-rw-r--r-- | src/osmo-bsc/net_init.c | 14 |
5 files changed, 119 insertions, 0 deletions
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c index bf150cb40..11cda6983 100644 --- a/src/osmo-bsc/bsc_init.c +++ b/src/osmo-bsc/bsc_init.c @@ -120,6 +120,29 @@ static struct gsm_network *bsc_network_init(void *ctx) if (!net->bts_unknown_statg) goto err_free_all; + net->all_allocated_sdcch = (struct time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(net->bsc_ctrs, BSC_CTR_ALL_ALLOCATED_SDCCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + net->all_allocated_tch = (struct time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(net->bsc_ctrs, BSC_CTR_ALL_ALLOCATED_TCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + INIT_LLIST_HEAD(&net->bts_rejected); gsm_net_update_ctype(net); diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c index ccba4a665..20ddd37b0 100644 --- a/src/osmo-bsc/bsc_stats.c +++ b/src/osmo-bsc/bsc_stats.c @@ -25,6 +25,7 @@ #include <osmocom/bsc/gsm_data.h> #include <osmocom/bsc/bts.h> +#include <osmocom/bsc/chan_counts.h> const struct rate_ctr_desc bsc_ctr_description[] = { [BSC_CTR_ASSIGNMENT_ATTEMPTED] = {"assignment:attempted", "Assignment attempts"}, @@ -102,6 +103,8 @@ const struct rate_ctr_desc bsc_ctr_description[] = { "Emergency call requests forwarded to an MSC (see also per-MSC counters"}, [BSC_CTR_MSCPOOL_EMERG_LOST] = {"mscpool:emerg:lost", "Emergency call requests lost because no MSC was found available"}, + [BSC_CTR_ALL_ALLOCATED_SDCCH] = {"all_allocated:sdcch", "Cumulative counter of seconds where all SDCCH channels were allocated"}, + [BSC_CTR_ALL_ALLOCATED_TCH] = {"all_allocated:tch", "Cumulative counter of seconds where all TCH channels were allocated"}, }; const struct rate_ctr_group_desc bsc_ctrg_desc = { @@ -185,4 +188,49 @@ void bsc_update_connection_stats(struct gsm_network *net) osmo_stat_item_set(osmo_stat_item_group_get_item(net->bsc_statg, BSC_STAT_NUM_TRX_RSL_CONNECTED), trx_rsl_connected_total); osmo_stat_item_set(osmo_stat_item_group_get_item(net->bsc_statg, BSC_STAT_NUM_TRX_TOTAL), num_trx_total); + + /* Make sure to notice cells that become disconnected */ + bsc_update_time_cc_all_allocated(net); +} + +void bsc_update_time_cc_all_allocated(struct gsm_network *net) +{ + struct gsm_bts *bts; + struct gsm_bts_trx *trx; + + struct chan_counts bsc_counts; + chan_counts_zero(&bsc_counts); + + llist_for_each_entry(bts, &net->bts_list, list) { + struct chan_counts bts_counts; + chan_counts_zero(&bts_counts); + + llist_for_each_entry(trx, &bts->trx_list, list) { + struct chan_counts trx_counts; + chan_counts_for_trx(&trx_counts, trx); + chan_counts_add(&bts_counts, &trx_counts); + } + + time_cc_set_flag(&bts->all_allocated_sdcch, + bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] + && !bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); + + time_cc_set_flag(&bts->all_allocated_tch, + (bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] + + bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) + && !(bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] + + bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); + + chan_counts_add(&bsc_counts, &bts_counts); + } + + time_cc_set_flag(&net->all_allocated_sdcch, + bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] + && !bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); + + time_cc_set_flag(&net->all_allocated_tch, + (bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] + + bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) + && !(bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] + + bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); } diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index 570195778..880cb22a6 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -211,6 +211,29 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm } bts->bts_statg = osmo_stat_item_group_alloc(bts, &bts_statg_desc, bts->nr); + bts->all_allocated_sdcch = (struct time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_ALL_ALLOCATED_SDCCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + bts->all_allocated_tch = (struct time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_ALL_ALLOCATED_TCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + /* create our primary TRX */ bts->c0 = gsm_bts_trx_alloc(bts); if (!bts->c0) { @@ -1236,6 +1259,12 @@ const struct rate_ctr_desc bts_ctr_description[] = { [BTS_CTR_SRVCC_ERROR] = \ { "srvcc:error", "Re-assignment failed for other reason" }, + [BTS_CTR_ALL_ALLOCATED_SDCCH] = \ + { "all_allocated:sdcch", + "Cumulative counter of seconds where all SDCCH channels were allocated" }, + [BTS_CTR_ALL_ALLOCATED_TCH] = \ + { "all_allocated:tch", + "Cumulative counter of seconds where all TCH channels were allocated" }, }; const struct rate_ctr_group_desc bts_ctrg_desc = { diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index d61d0327f..5ae6df651 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -40,6 +40,7 @@ #include <osmocom/bsc/bsc_msc_data.h> #include <osmocom/bsc/codec_pref.h> #include <osmocom/bsc/bts.h> +#include <osmocom/bsc/bsc_stats.h> static struct osmo_fsm lchan_fsm; @@ -517,6 +518,8 @@ static void lchan_fsm_unused_onenter(struct osmo_fsm_inst *fi, uint32_t prev_sta lchan_reset(lchan); osmo_fsm_inst_dispatch(lchan->ts->fi, TS_EV_LCHAN_UNUSED, lchan); + bsc_update_time_cc_all_allocated(bts->network); + /* Poll the channel request queue, so that waiting calls can make use of the lchan that just * has become unused now. */ abis_rsl_chan_rqd_queue_poll(bts); @@ -697,6 +700,8 @@ static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t p return; } + bsc_update_time_cc_all_allocated(bts->network); + lchan->conn = info->for_conn; /* If there is a previous lchan, and the new lchan is on the same cell as previous one, diff --git a/src/osmo-bsc/net_init.c b/src/osmo-bsc/net_init.c index 6d88adb3f..ec2f881e3 100644 --- a/src/osmo-bsc/net_init.c +++ b/src/osmo-bsc/net_init.c @@ -56,6 +56,20 @@ static struct osmo_tdef gsm_network_T_defs[] = { { .T=-12, .default_val=5, .desc="Timeout for obtaining TA after BSSLAP TA Request" }, { .T=-13, .default_val=5, .desc="Timeout for RR Channel Mode Modify ACK (BSC <-> MS)" }, { .T=-14, .default_val=5, .desc="Timeout for RSL Channel Mode Modify ACK (BSC <-> BTS)" }, + { .T = -16, .default_val = 1000, .unit = OSMO_TDEF_MS, + .desc = "Granularity for all_allocated:* rate counters: amount of milliseconds that one counter increment" + " represents. See also X17, X18" }, + { .T = -17, .default_val = 0, .unit = OSMO_TDEF_MS, + .desc = "Rounding threshold for all_allocated:* rate counters: round up to the next counter increment" + " after this many milliseconds. If set to half of X16 (or 0), employ the usual round() behavior:" + " round up after half of a granularity period. If set to 1, behave like ceil(): already" + " increment the counter immediately when all channels are allocated. If set >= X16, behave like" + " floor(): only increment after a full X16 period of all channels being occupied." + " See also X16, X18" }, + { .T = -18, .default_val = 60000, .unit = OSMO_TDEF_MS, + .desc = "Forget-sum period for all_allocated:* rate counters:" + " after this amount of idle time, forget internally cumulated time remainders. Zero to always" + " keep remainders. See also X16, X17." }, { .T=-3111, .default_val=4, .desc="Wait time after lchan was released in error (should be T3111 + 2s)" }, { .T=-3210, .default_val=20, .desc="After L3 Complete, wait for MSC to confirm" }, {} |