libbsc/libmsc: convert old osmo counter into rate_ctrgs

rate counters support the export to statsd and can have a delta value.

Change-Id: Ie749cebd53a0bb618d0e23d375885712078bf8dd
diff --git a/openbsc/src/libbsc/net_init.c b/openbsc/src/libbsc/net_init.c
index 6d03ee4..b99f3d2 100644
--- a/openbsc/src/libbsc/net_init.c
+++ b/openbsc/src/libbsc/net_init.c
@@ -80,36 +80,8 @@
 	INIT_LLIST_HEAD(&net->upqueue);
 	INIT_LLIST_HEAD(&net->bts_list);
 
-	net->stats.chreq.total = osmo_counter_alloc("net.chreq.total");
-	net->stats.chreq.no_channel = osmo_counter_alloc("net.chreq.no_channel");
-	net->stats.handover.attempted = osmo_counter_alloc("net.handover.attempted");
-	net->stats.handover.no_channel = osmo_counter_alloc("net.handover.no_channel");
-	net->stats.handover.timeout = osmo_counter_alloc("net.handover.timeout");
-	net->stats.handover.completed = osmo_counter_alloc("net.handover.completed");
-	net->stats.handover.failed = osmo_counter_alloc("net.handover.failed");
-	net->stats.loc_upd_type.attach = osmo_counter_alloc("net.loc_upd_type.attach");
-	net->stats.loc_upd_type.normal = osmo_counter_alloc("net.loc_upd_type.normal");
-	net->stats.loc_upd_type.periodic = osmo_counter_alloc("net.loc_upd_type.periodic");
-	net->stats.loc_upd_type.detach = osmo_counter_alloc("net.imsi_detach.count");
-	net->stats.loc_upd_resp.reject = osmo_counter_alloc("net.loc_upd_resp.reject");
-	net->stats.loc_upd_resp.accept = osmo_counter_alloc("net.loc_upd_resp.accept");
-	net->stats.paging.attempted = osmo_counter_alloc("net.paging.attempted");
-	net->stats.paging.detached = osmo_counter_alloc("net.paging.detached");
-	net->stats.paging.completed = osmo_counter_alloc("net.paging.completed");
-	net->stats.paging.expired = osmo_counter_alloc("net.paging.expired");
-	net->stats.sms.submitted = osmo_counter_alloc("net.sms.submitted");
-	net->stats.sms.no_receiver = osmo_counter_alloc("net.sms.no_receiver");
-	net->stats.sms.delivered = osmo_counter_alloc("net.sms.delivered");
-	net->stats.sms.rp_err_mem = osmo_counter_alloc("net.sms.rp_err_mem");
-	net->stats.sms.rp_err_other = osmo_counter_alloc("net.sms.rp_err_other");
-	net->stats.call.mo_setup = osmo_counter_alloc("net.call.mo_setup");
-	net->stats.call.mo_connect_ack = osmo_counter_alloc("net.call.mo_connect_ack");
-	net->stats.call.mt_setup = osmo_counter_alloc("net.call.mt_setup");
-	net->stats.call.mt_connect = osmo_counter_alloc("net.call.mt_connect");
-	net->stats.chan.rf_fail = osmo_counter_alloc("net.chan.rf_fail");
-	net->stats.chan.rll_err = osmo_counter_alloc("net.chan.rll_err");
-	net->stats.bts.oml_fail = osmo_counter_alloc("net.bts.oml_fail");
-	net->stats.bts.rsl_fail = osmo_counter_alloc("net.bts.rsl_fail");
+	/* init statistics */
+	net->ratectrs = rate_ctr_group_alloc(net, &msc_ctrg_desc, 0);
 
 	net->mncc_recv = mncc_recv;
 	net->ext_min = GSM_MIN_EXTEN;