aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-08-19 17:31:01 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-08-19 17:31:01 +0200
commitc3455dcb7951069dab99effae71aac2a14961823 (patch)
tree4d82851a8808d04fb68bea663fbac14ca5039855 /src
parentf416463a3c4fa3d94d8f8c7cdcfb04123fbee994 (diff)
client: Additional counters for the statistics
Add more counters and start counting them when reading from the PCAP library and when trying to write to the socket. Change-Id: I52d3064a265b402ac849d8578a14f718156c0805
Diffstat (limited to 'src')
-rw-r--r--src/osmo_client_core.c7
-rw-r--r--src/osmo_client_main.c2
-rw-r--r--src/osmo_client_network.c1
3 files changed, 8 insertions, 2 deletions
diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c
index 653d310..4455c95 100644
--- a/src/osmo_client_core.c
+++ b/src/osmo_client_core.c
@@ -1,7 +1,7 @@
/*
* osmo-pcap-client code
*
- * (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2011-2016 by Holger Hans Peter Freyther <holger@moiji-mobile.com>
* (C) 2011 by On-Waves
* All Rights Reserved
*
@@ -28,6 +28,7 @@
#include <osmocom/gprs/protocol/gsm_08_16.h>
#include <osmocom/gprs/protocol/gsm_08_18.h>
+#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/talloc.h>
#include <netinet/in.h>
@@ -158,8 +159,10 @@ static int pcap_read_cb(struct osmo_fd *fd, unsigned int what)
const u_char *data;
data = pcap_next(client->handle, &hdr);
- if (!data)
+ if (!data) {
+ rate_ctr_inc(&client->ctrg->ctr[CLIENT_CTR_PERR]);
return -1;
+ }
if (!forward_packet(client, &hdr, data))
return 0;
diff --git a/src/osmo_client_main.c b/src/osmo_client_main.c
index 945a871..0b53939 100644
--- a/src/osmo_client_main.c
+++ b/src/osmo_client_main.c
@@ -60,6 +60,8 @@ static const struct rate_ctr_desc pcap_client_ctr_desc[] = {
[CLIENT_CTR_2BIG] = { "bpf.too_big", "Captured data too big " },
[CLIENT_CTR_NOMEM] = { "client.no_mem", "No memory available " },
[CLIENT_CTR_QERR] = { "client.queue_err", "Can not queue data " },
+ [CLIENT_CTR_PERR] = { "client.pcap_err", "libpcap error " },
+ [CLIENT_CTR_WERR] = { "client.write_err", "Write error " },
};
static const struct rate_ctr_group_desc pcap_client_ctr_group_desc = {
diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c
index 7812ff6..2400f3a 100644
--- a/src/osmo_client_network.c
+++ b/src/osmo_client_network.c
@@ -92,6 +92,7 @@ static int write_cb(struct osmo_fd *fd, struct msgb *msg)
if (rc < 0) {
struct osmo_pcap_client *client = fd->data;
LOGP(DCLIENT, LOGL_ERROR, "Lost connection on write.\n");
+ rate_ctr_inc(&client->ctrg->ctr[CLIENT_CTR_WERR]);
lost_connection(client);
return -1;
}