ovs-benchmark: Improve output format for "rate" command.
authorBen Pfaff <blp@nicira.com>
Thu, 5 Jan 2012 18:44:40 +0000 (10:44 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 6 Jan 2012 16:10:27 +0000 (08:10 -0800)
Before, the "rate" command kept the status of the test continually updated
on the screen.  This form of output is nice to watch, but it isn't very
useful for reporting, because you only end up with a single number at the
end, and redirecting it to a file yields one long line with lots of
carriage returns.

This commit simplifies the output format by simply printing one line per
second.

Signed-off-by: Ben Pfaff <blp@nicira.com>
utilities/ovs-benchmark.c

index bc28dab69b5333b86452495b192f3ca994267469..e846902d856697dad1bc31bab4584819499d6d58 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2010, 2011 Nicira Networks.
+ * Copyright (c) 2010, 2011, 2012 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -467,12 +467,11 @@ cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
         }
 
         now = time_in_msec();
         }
 
         now = time_in_msec();
-        if (now >= prev + 10) {
+        if (now >= prev + 1000) {
             long long int elapsed = now - start;
             long long int elapsed = now - start;
-            printf("%.3f s elapsed, %u OK, %u failed, avg %.1f/s     \r",
+            printf("%.3f s elapsed, %u OK, %u failed, avg %.1f/s\n",
                    elapsed / 1000.0, completed - failures, failures,
                    completed / (elapsed / 1000.0));
                    elapsed / 1000.0, completed - failures, failures,
                    completed / (elapsed / 1000.0));
-            fflush(stdout);
             prev = now;
 
             if (timeout && elapsed > timeout * 1000LL) {
             prev = now;
 
             if (timeout && elapsed > timeout * 1000LL) {