stats: add BTS uptime counter
Change-Id: Ib17674bbe95e828cebff12de9e0b30f06447ef6c
This commit is contained in:
parent
377aac83bb
commit
858ac62b88
|
@ -143,6 +143,7 @@ extern const struct rate_ctr_desc bts_ctr_description[];
|
||||||
extern const struct rate_ctr_group_desc bts_ctrg_desc;
|
extern const struct rate_ctr_group_desc bts_ctrg_desc;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
BTS_STAT_UPTIME_SECONDS,
|
||||||
BTS_STAT_CHAN_LOAD_AVERAGE,
|
BTS_STAT_CHAN_LOAD_AVERAGE,
|
||||||
BTS_STAT_CHAN_CCCH_SDCCH4_USED,
|
BTS_STAT_CHAN_CCCH_SDCCH4_USED,
|
||||||
BTS_STAT_CHAN_CCCH_SDCCH4_TOTAL,
|
BTS_STAT_CHAN_CCCH_SDCCH4_TOTAL,
|
||||||
|
@ -646,6 +647,9 @@ struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
|
||||||
|
|
||||||
int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode);
|
int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode);
|
||||||
|
|
||||||
|
#define BTS_STORE_UPTIME_INTERVAL 10 /* in seconds */
|
||||||
|
void bts_store_uptime(struct gsm_bts *bts);
|
||||||
|
|
||||||
unsigned long long bts_uptime(const struct gsm_bts *bts);
|
unsigned long long bts_uptime(const struct gsm_bts *bts);
|
||||||
|
|
||||||
char *get_model_oml_status(const struct gsm_bts *bts);
|
char *get_model_oml_status(const struct gsm_bts *bts);
|
||||||
|
|
|
@ -1216,6 +1216,9 @@ struct gsm_network {
|
||||||
/* Timer for periodic channel load measurements to maintain each BTS's T3122. */
|
/* Timer for periodic channel load measurements to maintain each BTS's T3122. */
|
||||||
struct osmo_timer_list t3122_chan_load_timer;
|
struct osmo_timer_list t3122_chan_load_timer;
|
||||||
|
|
||||||
|
/* Timer to write each BTS's uptime counter state to the stats system. */
|
||||||
|
struct osmo_timer_list bts_store_uptime_timer;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct mgcp_client_conf *conf;
|
struct mgcp_client_conf *conf;
|
||||||
struct mgcp_client *client;
|
struct mgcp_client *client;
|
||||||
|
|
|
@ -85,6 +85,18 @@ static void update_t3122_chan_load_timer(void *data)
|
||||||
osmo_timer_schedule(&net->t3122_chan_load_timer, T3122_CHAN_LOAD_SAMPLE_INTERVAL, 0);
|
osmo_timer_schedule(&net->t3122_chan_load_timer, T3122_CHAN_LOAD_SAMPLE_INTERVAL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void bsc_store_bts_uptime(void *data)
|
||||||
|
{
|
||||||
|
struct gsm_network *net = data;
|
||||||
|
struct gsm_bts *bts;
|
||||||
|
|
||||||
|
llist_for_each_entry(bts, &net->bts_list, list)
|
||||||
|
bts_store_uptime(bts);
|
||||||
|
|
||||||
|
/* Keep this timer ticking. */
|
||||||
|
osmo_timer_schedule(&net->bts_store_uptime_timer, BTS_STORE_UPTIME_INTERVAL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static struct gsm_network *bsc_network_init(void *ctx)
|
static struct gsm_network *bsc_network_init(void *ctx)
|
||||||
{
|
{
|
||||||
struct gsm_network *net = gsm_network_init(ctx);
|
struct gsm_network *net = gsm_network_init(ctx);
|
||||||
|
@ -128,6 +140,10 @@ static struct gsm_network *bsc_network_init(void *ctx)
|
||||||
osmo_timer_setup(&net->t3122_chan_load_timer, update_t3122_chan_load_timer, net);
|
osmo_timer_setup(&net->t3122_chan_load_timer, update_t3122_chan_load_timer, net);
|
||||||
osmo_timer_schedule(&net->t3122_chan_load_timer, T3122_CHAN_LOAD_SAMPLE_INTERVAL, 0);
|
osmo_timer_schedule(&net->t3122_chan_load_timer, T3122_CHAN_LOAD_SAMPLE_INTERVAL, 0);
|
||||||
|
|
||||||
|
/* Init uptime tracking timer. */
|
||||||
|
osmo_timer_setup(&net->bts_store_uptime_timer, bsc_store_bts_uptime, net);
|
||||||
|
osmo_timer_schedule(&net->bts_store_uptime_timer, BTS_STORE_UPTIME_INTERVAL, 0);
|
||||||
|
|
||||||
net->cbc->net = net;
|
net->cbc->net = net;
|
||||||
net->cbc->mode = BSC_CBC_LINK_MODE_DISABLED;
|
net->cbc->mode = BSC_CBC_LINK_MODE_DISABLED;
|
||||||
net->cbc->server.local_addr = bsc_cbc_default_server_local_addr;
|
net->cbc->server.local_addr = bsc_cbc_default_server_local_addr;
|
||||||
|
|
|
@ -556,6 +556,11 @@ struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bts_store_uptime(struct gsm_bts *bts)
|
||||||
|
{
|
||||||
|
osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_UPTIME_SECONDS], bts_uptime(bts));
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long long bts_uptime(const struct gsm_bts *bts)
|
unsigned long long bts_uptime(const struct gsm_bts *bts)
|
||||||
{
|
{
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
|
@ -1112,6 +1117,10 @@ const struct rate_ctr_group_desc bts_ctrg_desc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct osmo_stat_item_desc bts_stat_desc[] = {
|
const struct osmo_stat_item_desc bts_stat_desc[] = {
|
||||||
|
[BTS_STAT_UPTIME_SECONDS] = \
|
||||||
|
{ "uptime:seconds",
|
||||||
|
"Seconds of uptime",
|
||||||
|
"s", 60, 0 },
|
||||||
[BTS_STAT_CHAN_LOAD_AVERAGE] = \
|
[BTS_STAT_CHAN_LOAD_AVERAGE] = \
|
||||||
{ "chanloadavg",
|
{ "chanloadavg",
|
||||||
"Channel load average",
|
"Channel load average",
|
||||||
|
|
Loading…
Reference in New Issue