From 26b338bbb6d10ca19eabee2bcb0bdf9ef82bca63 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sat, 19 Nov 2016 16:28:11 +0100 Subject: tools: Use busy waiting in operf Using nanosleep in between sending SDUs is not accurate enough when sending thousands of SDUs per second. The --sleep option is added for lowering CPU consumption in low bandwidth tests. --- src/tools/operf/operf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/tools/operf/operf.c') diff --git a/src/tools/operf/operf.c b/src/tools/operf/operf.c index b52109cf..46dfc14d 100644 --- a/src/tools/operf/operf.c +++ b/src/tools/operf/operf.c @@ -41,6 +41,7 @@ struct c { int size; long rate; bool flood; + bool sleep; int duration; size_t sent; @@ -81,6 +82,7 @@ static void usage(void) " -r, --rate Rate (b/s)\n" " -s, --size Payload size (B, default 1500)\n" " -f, --flood Send SDUs as fast as possible\n" + " --sleep Sleep in between sending SDUs\n" " --help Display this help text and exit\n"); } @@ -100,6 +102,7 @@ int main(int argc, char ** argv) server.timeout = 1000; /* ms */ client.rate = 1000000; client.flood = false; + client.sleep = false; while (argc > 0) { if (strcmp(*argv, "-n") == 0 || @@ -127,6 +130,8 @@ int main(int argc, char ** argv) } else if (strcmp(*argv, "-f") == 0 || strcmp(*argv, "--flood") == 0) { client.flood = true; + } else if (strcmp(*argv, "--sleep") == 0) { + client.sleep = true; } else if (strcmp(*argv, "-l") == 0 || strcmp(*argv, "--listen") == 0) { serv = true; -- cgit v1.2.3