summaryrefslogtreecommitdiff
path: root/src/tools/oping/oping_client.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2018-06-01 16:56:51 +0200
committerDimitri Staessens <dimitri.staessens@ugent.be>2018-06-01 18:19:57 +0200
commit22b3bdbe0e82b3a58d963a344e9227aa7c35e05a (patch)
tree3255210d367a41c34936f1247d98b0cb231bb087 /src/tools/oping/oping_client.c
parent3fe8431c5044e1337be78d82446d107299106919 (diff)
downloadouroboros-22b3bdbe0e82b3a58d963a344e9227aa7c35e05a.tar.gz
ouroboros-22b3bdbe0e82b3a58d963a344e9227aa7c35e05a.zip
tools: Add timestamp option to oping
This adds a timestamp option to oping, similar to the one in regular ping and rinaperf, so that we can more easily correlate time and latency. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Diffstat (limited to 'src/tools/oping/oping_client.c')
-rw-r--r--src/tools/oping/oping_client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index 97e9c8d3..e48b01cf 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -98,6 +98,14 @@ void * reader(void * o)
ms = ts_diff_us(&sent, &now) / 1000.0;
+ if (client.timestamp) {
+ struct timespec rtc;
+ clock_gettime(CLOCK_REALTIME, &rtc);
+ printf("[%zd.%06zu] ",
+ (ssize_t) rtc.tv_sec,
+ (size_t) rtc.tv_nsec / 1000);
+ }
+
printf("%d bytes from %s: seq=%d time=%.3f ms\n",
msg_len,
client.s_apn,