aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-07-19 12:53:04 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2012-07-19 12:53:04 +0200
commit0db9b568f2922794c412f6d703da0c8e06e5e214 (patch)
tree252096954dd739eef806a6de7840110aefea08df
parent6071c652cf9607adef694ede48384746e2377f4f (diff)
osmux: add DEBUG_TIMING to make sure timing reconstruction is OK
by now, it is set on by default.
-rw-r--r--src/osmux.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/osmux.c b/src/osmux.c
index 37645db..38859b3 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -22,6 +22,8 @@
#include <arpa/inet.h>
+#define DEBUG_TIMING 1
+
#define OSMUX_BATCH_MAX 1480 /* XXX: MTU - iphdr (20 bytes) */
struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg)
@@ -225,11 +227,21 @@ struct osmux_tx_handle {
struct msgb *msg;
void (*tx_cb)(struct msgb *msg, void *data);
void *data;
+#ifdef DEBUG_TIMING
+ struct timeval start;
+#endif
};
static void osmux_tx_cb(void *data)
{
struct osmux_tx_handle *h = data;
+#ifdef DEBUG_TIMING
+ struct timeval now, diff;
+
+ gettimeofday(&now, NULL);
+ timersub(&now, &h->start, &diff);
+ printf("difference %lu.%.6lu\n", diff.tv_sec, diff.tv_usec);
+#endif
h->tx_cb(h->msg, h->data);
@@ -251,6 +263,9 @@ void osmux_tx_sched(struct msgb *msg, struct timeval *when,
h->timer.cb = osmux_tx_cb;
h->timer.data = h;
+#ifdef DEBUG_TIMING
+ gettimeofday(&h->start, NULL);
+#endif
/* send it now */
if (when->tv_sec == 0 && when->tv_usec == 0) {
osmux_tx_cb(h);