stats: report a number of configured BTS to a stats gauge.
It's useful to know how many BTS are actually configured to compare it to a number of connected BTS's. Change-Id: I41cb60f9cb962003227e4a7b63db05acbcdb6f4c
This commit is contained in:
parent
5e89333b27
commit
db54283954
|
@ -1562,6 +1562,11 @@ static const struct rate_ctr_group_desc bsc_ctrg_desc = {
|
||||||
bsc_ctr_description,
|
bsc_ctr_description,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Constants for the BSC stats */
|
||||||
|
enum {
|
||||||
|
BSC_STAT_NUM_BTS_TOTAL,
|
||||||
|
};
|
||||||
|
|
||||||
struct gsm_tz {
|
struct gsm_tz {
|
||||||
int override; /* if 0, use system's time zone instead. */
|
int override; /* if 0, use system's time zone instead. */
|
||||||
int hr; /* hour */
|
int hr; /* hour */
|
||||||
|
@ -1588,7 +1593,9 @@ struct gsm_network {
|
||||||
struct osmo_timer_list congestion_check_timer;
|
struct osmo_timer_list congestion_check_timer;
|
||||||
} hodec2;
|
} hodec2;
|
||||||
|
|
||||||
|
/* structures for keeping rate counters and gauge stats */
|
||||||
struct rate_ctr_group *bsc_ctrs;
|
struct rate_ctr_group *bsc_ctrs;
|
||||||
|
struct osmo_stat_item_group *bsc_statg;
|
||||||
|
|
||||||
unsigned int num_bts;
|
unsigned int num_bts;
|
||||||
struct llist_head bts_list;
|
struct llist_head bts_list;
|
||||||
|
|
|
@ -44,6 +44,18 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
static const struct osmo_stat_item_desc bsc_stat_desc[] = {
|
||||||
|
{ "num_bts:total", "Number of configured BTS for this BSC", "", 16, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct osmo_stat_item_group_desc bsc_statg_desc = {
|
||||||
|
.group_name_prefix = "bsc",
|
||||||
|
.group_description = "base station controller",
|
||||||
|
.class_id = OSMO_STATS_CLASS_GLOBAL,
|
||||||
|
.num_items = ARRAY_SIZE(bsc_stat_desc),
|
||||||
|
.item_desc = bsc_stat_desc,
|
||||||
|
};
|
||||||
|
|
||||||
int bsc_shutdown_net(struct gsm_network *net)
|
int bsc_shutdown_net(struct gsm_network *net)
|
||||||
{
|
{
|
||||||
struct gsm_bts *bts;
|
struct gsm_bts *bts;
|
||||||
|
@ -268,6 +280,12 @@ static struct gsm_network *bsc_network_init(void *ctx)
|
||||||
talloc_free(net);
|
talloc_free(net);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
net->bsc_statg = osmo_stat_item_group_alloc(net, &bsc_statg_desc, 0);
|
||||||
|
if (!net->bsc_statg) {
|
||||||
|
rate_ctr_group_free(net->bsc_ctrs);
|
||||||
|
talloc_free(net);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_LLIST_HEAD(&net->bts_rejected);
|
INIT_LLIST_HEAD(&net->bts_rejected);
|
||||||
gsm_net_update_ctype(net);
|
gsm_net_update_ctype(net);
|
||||||
|
|
|
@ -2077,6 +2077,7 @@ DEFUN(cfg_bts,
|
||||||
/* allocate a new one */
|
/* allocate a new one */
|
||||||
bts = bsc_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
|
bts = bsc_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
|
||||||
HARDCODED_BSIC);
|
HARDCODED_BSIC);
|
||||||
|
osmo_stat_item_inc(gsmnet->bsc_statg->items[BSC_STAT_NUM_BTS_TOTAL], 1);
|
||||||
/*
|
/*
|
||||||
* Initialize bts->acc_ramp here. Else we could segfault while
|
* Initialize bts->acc_ramp here. Else we could segfault while
|
||||||
* processing a configuration file with ACC ramping settings.
|
* processing a configuration file with ACC ramping settings.
|
||||||
|
|
Loading…
Reference in New Issue