stat: add blocksize to averaged log, if it's consistent
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index 8c41914446ce610f4dcfb6d67ae4535ebf6255c0..4d87c29a6fe19afbf9661c84c1adb555e48f2b2b 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -15,6 +15,7 @@
 #include "idletime.h"
 #include "lib/pow2.h"
 #include "lib/output_buffer.h"
+#include "helper_thread.h"
 
 struct fio_mutex *stat_mutex;
 
@@ -2168,8 +2169,14 @@ static int add_bw_samples(struct thread_data *td, struct timeval *t)
 
                add_stat_sample(&ts->bw_stat[ddir], rate);
 
-               if (td->bw_log)
-                       add_log_sample(td, td->bw_log, rate, ddir, 0, 0);
+               if (td->bw_log) {
+                       unsigned int bs = 0;
+
+                       if (td->o.min_bs[ddir] == td->o.max_bs[ddir])
+                               bs = td->o.min_bs[ddir];
+
+                       add_log_sample(td, td->bw_log, rate, ddir, bs, 0);
+               }
 
                td->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
        }
@@ -2233,8 +2240,14 @@ static int add_iops_samples(struct thread_data *td, struct timeval *t)
 
                add_stat_sample(&ts->iops_stat[ddir], iops);
 
-               if (td->iops_log)
-                       add_log_sample(td, td->iops_log, iops, ddir, 0, 0);
+               if (td->iops_log) {
+                       unsigned int bs = 0;
+
+                       if (td->o.min_bs[ddir] == td->o.max_bs[ddir])
+                               bs = td->o.min_bs[ddir];
+
+                       add_log_sample(td, td->iops_log, iops, ddir, bs, 0);
+               }
 
                td->stat_io_blocks[ddir] = td->this_io_blocks[ddir];
        }
@@ -2246,7 +2259,6 @@ static int add_iops_samples(struct thread_data *td, struct timeval *t)
        if (spent <= td->o.iops_avg_time)
                return td->o.iops_avg_time;
 
-       printf("%lu over\n", spent - td->o.iops_avg_time);
        return td->o.iops_avg_time - (1 + spent - td->o.iops_avg_time);
 }