add machinereadable output for the data printed every second
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 14 Oct 2009 06:29:44 +0000 (17:29 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 14 Oct 2009 06:29:44 +0000 (17:29 +1100)
@W@1@1085@0.74@1@21.302@

first field is W R or C   representing the state of the run
Warmup, Running or Cleanup

dbench.c

index 554b806879b6c4182838518c3376509fa767ffd5..147be2350a548797001eb9aae0f0067af5748f0d 100644 (file)
--- a/dbench.c
+++ b/dbench.c
@@ -148,16 +148,34 @@ static void sig_alarm(int sig)
        }
 
         if (in_warmup) {
-                printf("%4d  %8d  %7.2f MB/sec  warmup %3.0f sec  latency %.03f ms\n", 
+               if (options.machine_readable) {
+                    printf("@W@%d@%d@%.2f@%u@%.03f@\n", 
                        num_active, total_lines/nclients, 
-                       1.0e-6 * total_bytes / t, t, latency*1000);
+                          1.0e-6 * total_bytes / t, (int)t, latency*1000);
+               } else {
+                    printf("%4d  %8d  %7.2f MB/sec  warmup %3.0f sec  latency %.03f ms\n", 
+                       num_active, total_lines/nclients, 
+                          1.0e-6 * total_bytes / t, t, latency*1000);
+               }
         } else if (in_cleanup) {
-                printf("%4d  cleanup %3.0f sec\n", nclients - num_finished, t);
+               if (options.machine_readable) {
+                    printf("@C@%d@%d@%.2f@%u@%.03f@\n", 
+                       num_active, total_lines/nclients, 
+                          1.0e-6 * total_bytes / t, (int)t, latency*1000);
+               } else {
+                    printf("%4d  cleanup %3.0f sec\n", nclients - num_finished, t);
+               }
         } else {
-                printf("%4d  %8d  %7.2f MB/sec  execute %3.0f sec  latency %.03f ms\n", 
+               if (options.machine_readable) {
+                    printf("@R@%d@%d@%.2f@%u@%.03f@\n", 
+                       num_active, total_lines/nclients, 
+                          1.0e-6 * total_bytes / t, (int)t, latency*1000);
+               } else {
+                    printf("%4d  %8d  %7.2f MB/sec  execute %3.0f sec  latency %.03f ms\n", 
                        nclients, total_lines/nclients, 
                        1.0e-6 * total_bytes / t, t, latency*1000);
-               throughput = 1.0e-6 * total_bytes / t;
+                      throughput = 1.0e-6 * total_bytes / t;
+               }
         }
 
        fflush(stdout);