msc: add counters to track call attempts/active/success/failed

active_calls describe all calls in active state.
call.complete Call got terminated by disconnect requested either by MS or MSC.
call.incomplete Call got terminated by any other reason.
call.active Calls reached active state.
Change-Id: I49b93af2e6a0ba16c2fb00b7b83974e8a6a16df3
This commit is contained in:
Alexander Couzens 2016-08-23 07:32:27 +02:00
parent 38e9ea3f7f
commit 92f552f344
3 changed files with 42 additions and 1 deletions

View File

@ -215,6 +215,9 @@ enum {
MSC_CTR_CALL_MO_CONNECT_ACK,
MSC_CTR_CALL_MT_SETUP,
MSC_CTR_CALL_MT_CONNECT,
MSC_CTR_CALL_ACTIVE,
MSC_CTR_CALL_COMPLETE,
MSC_CTR_CALL_INCOMPLETE,
};
static const struct rate_ctr_desc msc_ctr_description[] = {
@ -235,6 +238,9 @@ static const struct rate_ctr_desc msc_ctr_description[] = {
[MSC_CTR_CALL_MO_CONNECT_ACK] = {"call.mo_connect_ack", "Received a connect ack from MS of a MO call. Call is now succesful connected up."},
[MSC_CTR_CALL_MT_SETUP] = {"call.mt_setup", "Sent setup requests to the MS (MT)."},
[MSC_CTR_CALL_MT_CONNECT] = {"call.mt_connect", "Sent a connect to the MS (MT)."},
[MSC_CTR_CALL_ACTIVE] = {"call.active", "Count total amount of calls that ever reached active state."},
[MSC_CTR_CALL_COMPLETE] = {"call.complete", "Count total amount of calls which got terminated by disconnect req or ind after reaching active state."},
[MSC_CTR_CALL_INCOMPLETE] = {"call.incomplete", "Count total amount of call which got terminated by any other reason after reaching active state."},
};
@ -298,7 +304,7 @@ struct gsm_network {
struct rate_ctr_group *bsc_ctrs;
struct rate_ctr_group *msc_ctrs;
struct osmo_counter *active_calls;
/* layer 4 */
struct mncc_sock_state *mncc_state;

View File

@ -86,6 +86,7 @@ struct gsm_network *gsm_network_init(void *ctx,
/* init statistics */
net->bsc_ctrs = rate_ctr_group_alloc(net, &bsc_ctrg_desc, 0);
net->msc_ctrs = rate_ctr_group_alloc(net, &msc_ctrg_desc, 0);
net->active_calls = osmo_counter_alloc("msc.active_calls");
net->mncc_recv = mncc_recv;
net->ext_min = GSM_MIN_EXTEN;

View File

@ -1299,6 +1299,39 @@ int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_
return gsm48_conn_sendmsg(msg, conn, NULL);
}
/* FIXME: this count_statistics is a state machine behaviour. we should convert
* the complete call control into a state machine. Afterwards we can move this
* code into state transitions.
*/
static void count_statistics(struct gsm_trans *trans, int new_state)
{
int old_state = trans->cc.state;
struct rate_ctr_group *msc = trans->net->msc_ctrs;
if (old_state == new_state)
return;
/* state incoming */
switch (new_state) {
case GSM_CSTATE_ACTIVE:
osmo_counter_inc(trans->net->active_calls);
rate_ctr_inc(&msc->ctr[MSC_CTR_CALL_ACTIVE]);
break;
}
/* state outgoing */
switch (old_state) {
case GSM_CSTATE_ACTIVE:
osmo_counter_dec(trans->net->active_calls);
if (new_state == GSM_CSTATE_DISCONNECT_REQ ||
new_state == GSM_CSTATE_DISCONNECT_IND)
rate_ctr_inc(&msc->ctr[MSC_CTR_CALL_COMPLETE]);
else
rate_ctr_inc(&msc->ctr[MSC_CTR_CALL_INCOMPLETE]);
break;
}
}
/* Call Control */
/* The entire call control code is written in accordance with Figure 7.10c
@ -1315,6 +1348,7 @@ static void new_cc_state(struct gsm_trans *trans, int state)
gsm48_cc_state_name(trans->cc.state),
gsm48_cc_state_name(state));
count_statistics(trans, state);
trans->cc.state = state;
}