diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2019-04-27 23:45:37 +0200 |
---|---|---|
committer | lynxis lazus <lynxis@fe80.eu> | 2019-07-18 14:50:51 +0000 |
commit | efa7b9713361e89f9e337f0571e788c611c9ed64 (patch) | |
tree | 4875707df0b7f9a2d76275948f33e573f8f9935e /src | |
parent | 3a357de631943b8581f5bc304f6935c2a768f8b6 (diff) |
replace osmo_counter with stat_items
osmo_counter will be soon deprecated. Use the newer and more flexible
osmo_stat_item instead.
Depends on: Id2462c4866bd22bc2338c9c8f69b775f88ae7511 (libosmocore)
Change-Id: I6a20123b263f4f808153794ee8a735092deb399e
Diffstat (limited to 'src')
-rw-r--r-- | src/libmsc/gsm_04_08_cc.c | 4 | ||||
-rw-r--r-- | src/libmsc/gsm_09_11.c | 7 | ||||
-rw-r--r-- | src/libmsc/msc_net_init.c | 11 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index 2869bba12..03830de63 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -161,7 +161,7 @@ static void count_statistics(struct gsm_trans *trans, int new_state) /* state incoming */ switch (new_state) { case GSM_CSTATE_ACTIVE: - osmo_counter_inc(trans->net->active_calls); + osmo_stat_item_inc(trans->net->statg->items[MSC_STAT_ACTIVE_CALLS], 1); rate_ctr_inc(&msc->ctr[MSC_CTR_CALL_ACTIVE]); break; } @@ -169,7 +169,7 @@ static void count_statistics(struct gsm_trans *trans, int new_state) /* state outgoing */ switch (old_state) { case GSM_CSTATE_ACTIVE: - osmo_counter_dec(trans->net->active_calls); + osmo_stat_item_dec(trans->net->statg->items[MSC_STAT_ACTIVE_CALLS], 1); if (new_state == GSM_CSTATE_DISCONNECT_REQ || new_state == GSM_CSTATE_DISCONNECT_IND) rate_ctr_inc(&msc->ctr[MSC_CTR_CALL_COMPLETE]); diff --git a/src/libmsc/gsm_09_11.c b/src/libmsc/gsm_09_11.c index 79fcb5a97..8a13cdad6 100644 --- a/src/libmsc/gsm_09_11.c +++ b/src/libmsc/gsm_09_11.c @@ -32,6 +32,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/rate_ctr.h> +#include <osmocom/core/stat_item.h> #include <osmocom/core/utils.h> #include <osmocom/core/msgb.h> @@ -158,7 +159,7 @@ int gsm0911_rcv_nc_ss(struct msc_a *msc_a, struct msgb *msg) ncss_session_timeout_handler, trans); /* Count active NC SS/USSD sessions */ - osmo_counter_inc(net->active_nc_ss); + osmo_stat_item_inc(net->statg->items[MSC_STAT_ACTIVE_NC_SS], 1); trans->dlci = OMSC_LINKID_CB(msg); trans->msc_a = msc_a; @@ -362,7 +363,7 @@ static struct gsm_trans *establish_nc_ss_trans(struct gsm_network *net, } /* Count active NC SS/USSD sessions */ - osmo_counter_inc(net->active_nc_ss); + osmo_stat_item_inc(net->statg->items[MSC_STAT_ACTIVE_NC_SS], 1); /* Init inactivity timer */ osmo_timer_setup(&trans->ss.timer_guard, @@ -414,7 +415,7 @@ void _gsm911_nc_ss_trans_free(struct gsm_trans *trans) osmo_timer_del(&trans->ss.timer_guard); /* One session less */ - osmo_counter_dec(trans->net->active_nc_ss); + osmo_stat_item_dec(trans->net->statg->items[MSC_STAT_ACTIVE_NC_SS], 1); } int gsm0911_gsup_rx(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg) diff --git a/src/libmsc/msc_net_init.c b/src/libmsc/msc_net_init.c index 4a752bf76..11920f377 100644 --- a/src/libmsc/msc_net_init.c +++ b/src/libmsc/msc_net_init.c @@ -35,6 +35,8 @@ struct osmo_tdef mncc_tdefs[] = { {} }; +#include <osmocom/core/stat_item.h> + struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv) { struct gsm_network *net; @@ -66,8 +68,13 @@ struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv) talloc_free(net); return NULL; } - net->active_calls = osmo_counter_alloc("msc.active_calls"); - net->active_nc_ss = osmo_counter_alloc("msc.active_nc_ss"); + + net->statg = osmo_stat_item_group_alloc(net, &msc_statg_desc, 0); + if (!net->statg) { + rate_ctr_group_free(net->msc_ctrs); + talloc_free(net); + return NULL; + } net->mncc_tdefs = mncc_tdefs; net->mncc_recv = mncc_recv; |