aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-16 17:26:40 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 11:33:14 +0100
commitffb70fb66a0dc25794d8e9db38d84760bc5cb779 (patch)
treef45dc86e45abf5a426bde9ac928809ffc41ac922
parenta0215b1d46657a7aaafa4f8f743eddd72e5f7d40 (diff)
stats: Start handling stats for a mtp_linkon-waves/stats
-rw-r--r--include/bsc_data.h2
-rw-r--r--src/link_udp.c4
-rw-r--r--src/links.c4
3 files changed, 10 insertions, 0 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index fa04c3a..992e55b 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -37,6 +37,7 @@
struct bsc_data;
struct snmp_mtp_session;
+struct rate_ctr_group;
/**
* A link to the underlying MTP2 library or such
@@ -62,6 +63,7 @@ struct link_data {
int pcap_fd;
struct bsc_data *bsc;
struct mtp_link_set *the_link;
+ struct rate_ctr_group *ctrg;
int available;
diff --git a/src/link_udp.c b/src/link_udp.c
index e05bd17..ef75f41 100644
--- a/src/link_udp.c
+++ b/src/link_udp.c
@@ -25,6 +25,7 @@
#include <mtp_pcap.h>
#include <snmp_mtp.h>
#include <cellmgr_debug.h>
+#include <counter.h>
#include <osmocore/talloc.h>
@@ -91,11 +92,13 @@ static int udp_read_cb(struct bsc_fd *fd)
if (hdr->data_type == UDP_DATA_RETR_COMPL || hdr->data_type == UDP_DATA_RETR_IMPOS) {
LOGP(DINP, LOGL_ERROR, "Link retrieval done. Restarting the link.\n");
+ rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_ERROR]);
mtp_link_down(link);
mtp_link_up(link);
goto exit;
} else if (hdr->data_type > UDP_DATA_MSU_PRIO_3) {
LOGP(DINP, LOGL_ERROR, "Link failure. retrieved message.\n");
+ rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_ERROR]);
mtp_link_down(link);
goto exit;
}
@@ -113,6 +116,7 @@ static int udp_read_cb(struct bsc_fd *fd)
LOGP(DINP, LOGL_DEBUG, "MSU data on: %p data %s.\n", link, hexdump(msg->data, msg->len));
if (link->pcap_fd >= 0)
mtp_pcap_write_msu(link->pcap_fd, msg->l2h, msgb_l2len(msg));
+ rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_IN]);
mtp_link_set_data(link->the_link, msg);
exit:
diff --git a/src/links.c b/src/links.c
index 016542d..4889135 100644
--- a/src/links.c
+++ b/src/links.c
@@ -24,6 +24,7 @@
#include <cellmgr_debug.h>
#include <mtp_data.h>
#include <snmp_mtp.h>
+#include <counter.h>
#include <osmocore/talloc.h>
@@ -73,6 +74,7 @@ void mtp_link_set_sccp_down(struct mtp_link_set *link)
void mtp_link_submit(struct link_data *link, struct msgb *msg)
{
+ rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_OUT]);
link->write(link, msg);
}
@@ -110,6 +112,8 @@ int link_init(struct bsc_data *bsc)
bsc->link_set->bsc = bsc;
lnk = talloc_zero(bsc->link_set, struct link_data);
+ lnk->ctrg = rate_ctr_group_alloc(lnk,
+ mtp_link_rate_ctr_desc(), 1);
lnk->bsc = bsc;
lnk->udp.link_index = 1;
lnk->pcap_fd = bsc->pcap_fd;