aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/handover_logic.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2009-12-22 19:07:32 +0100
committerHarald Welte <laforge@netfilter.org>2009-12-22 20:42:40 +0100
commitffa55a4e8783419f60932ef2f9e872293cf932b9 (patch)
treec615771fe04a89807a012d8e100de53847b70d0f /openbsc/src/handover_logic.c
parent4983921af1a84ea20c6be7944bf0ff4928578a69 (diff)
statistics: Introduce 'struct counter' instead of using unsigned long
This has the advantage that counters can be added all over the code very easily, while having only one routine that stores all of the current counter values to the database. The counters are synced every 60 seconds, providing relatively fine grained statistics about the network usage as time passes by.
Diffstat (limited to 'openbsc/src/handover_logic.c')
-rw-r--r--openbsc/src/handover_logic.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/openbsc/src/handover_logic.c b/openbsc/src/handover_logic.c
index 393b0f2a..5297ab6c 100644
--- a/openbsc/src/handover_logic.c
+++ b/openbsc/src/handover_logic.c
@@ -97,12 +97,12 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
DEBUGP(DHO, "(old_lchan on BTS %u, new BTS %u)\n",
old_lchan->ts->trx->bts->nr, bts->nr);
- bts->network->stats.handover.attempted++;
+ counter_inc(bts->network->stats.handover.attempted);
new_lchan = lchan_alloc(bts, old_lchan->type);
if (!new_lchan) {
LOGP(DHO, LOGL_NOTICE, "No free channel\n");
- bts->network->stats.handover.no_channel++;
+ counter_inc(bts->network->stats.handover.no_channel);
return -ENOSPC;
}
@@ -144,9 +144,10 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
static void ho_T3103_cb(void *_ho)
{
struct bsc_handover *ho = _ho;
+ struct gsm_network *net = ho->new_lchan->ts->trx->bts->network;
DEBUGP(DHO, "HO T3103 expired\n");
- ho->new_lchan->ts->trx->bts->network->stats.handover.timeout++;
+ counter_inc(net->stats.handover.timeout);
lchan_free(ho->new_lchan);
llist_del(&ho->list);
@@ -207,6 +208,7 @@ static int ho_chan_activ_nack(struct gsm_lchan *new_lchan)
/* GSM 04.08 HANDOVER COMPLETE has been received on new channel */
static int ho_gsm48_ho_compl(struct gsm_lchan *new_lchan)
{
+ struct gsm_network *net = new_lchan->ts->trx->bts->network;
struct bsc_handover *ho;
ho = bsc_ho_by_new_lchan(new_lchan);
@@ -215,7 +217,7 @@ static int ho_gsm48_ho_compl(struct gsm_lchan *new_lchan)
return -ENODEV;
}
- new_lchan->ts->trx->bts->network->stats.handover.completed++;
+ counter_inc(net->stats.handover.completed);
bsc_del_timer(&ho->T3103);
@@ -236,6 +238,7 @@ static int ho_gsm48_ho_compl(struct gsm_lchan *new_lchan)
/* GSM 04.08 HANDOVER FAIL has been received */
static int ho_gsm48_ho_fail(struct gsm_lchan *old_lchan)
{
+ struct gsm_network *net = old_lchan->ts->trx->bts->network;
struct bsc_handover *ho;
ho = bsc_ho_by_old_lchan(old_lchan);
@@ -244,7 +247,7 @@ static int ho_gsm48_ho_fail(struct gsm_lchan *old_lchan)
return -ENODEV;
}
- old_lchan->ts->trx->bts->network->stats.handover.failed++;
+ counter_inc(net->stats.handover.failed);
bsc_del_timer(&ho->T3103);
llist_del(&ho->list);