summaryrefslogtreecommitdiff
path: root/src/tools/oping/oping.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.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.c')
-rw-r--r--src/tools/oping/oping.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/tools/oping/oping.c b/src/tools/oping/oping.c
index 3c1d4fe9..40578742 100644
--- a/src/tools/oping/oping.c
+++ b/src/tools/oping/oping.c
@@ -70,6 +70,7 @@ struct c {
int interval;
uint32_t count;
int size;
+ bool timestamp;
/* stats */
uint32_t sent;
@@ -115,16 +116,19 @@ static void usage(void)
"\n"
" -c, --count Number of packets (default 1000)\n"
" -i, --interval Interval (ms, default 1000)\n"
- " -n, --server-apn Name of the oping server\n"
+ " -n, --server-name Name of the oping server\n"
" -s, --size Payload size (B, default 64)\n"
+ " -D, --timeofday Print time of day before each line"
+ "\n"
" --help Display this help text and exit\n");
}
-int main(int argc, char ** argv)
+int main(int argc,
+ char ** argv)
{
- int ret = -1;
- char * rem = NULL;
- bool serv = false;
+ int ret = -1;
+ char * rem = NULL;
+ bool serv = false;
argc--;
argv++;
@@ -133,6 +137,7 @@ int main(int argc, char ** argv)
client.interval = 1000;
client.size = 64;
client.count = 1000;
+ client.timestamp = false;
while (argc > 0) {
if (strcmp(*argv, "-i") == 0 ||
@@ -140,7 +145,7 @@ int main(int argc, char ** argv)
client.interval = strtol(*(++argv), &rem, 10);
--argc;
} else if (strcmp(*argv, "-n") == 0 ||
- strcmp(*argv, "--server_apn") == 0) {
+ strcmp(*argv, "--server_name") == 0) {
client.s_apn = *(++argv);
--argc;
} else if (strcmp(*argv, "-c") == 0 ||
@@ -154,6 +159,9 @@ int main(int argc, char ** argv)
} else if (strcmp(*argv, "-l") == 0 ||
strcmp(*argv, "--listen") == 0) {
serv = true;
+ } else if (strcmp(*argv, "-D") == 0 ||
+ strcmp(*argv, "--timeofday") == 0) {
+ client.timestamp = true;
} else {
usage();
exit(EXIT_SUCCESS);