Include sg headers in os/os-linux.h
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index 6e47c34cbbcaf528a4951519c8383b0e8e6b9c96..1f124a8c0b65d40d080638e3aa2a7a4089f061df 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1825,8 +1825,10 @@ void __show_run_stats(void)
        }
 
        for (i = 0; i < FIO_OUTPUT_NR; i++) {
-               buf_output_flush(&output[i]);
-               buf_output_free(&output[i]);
+               struct buf_output *out = &output[i];
+               log_info_buf(out->buf, out->buflen);
+               buf_output_clear(out);
+               buf_output_free(out);
        }
 
        log_info_flush();
@@ -2465,7 +2467,7 @@ static int __add_samples(struct thread_data *td, struct timeval *parent_tv,
 
                add_stat_sample(&stat[ddir], rate);
 
-               if (td->bw_log) {
+               if (log) {
                        unsigned int bs = 0;
 
                        if (td->o.min_bs[ddir] == td->o.max_bs[ddir])
@@ -2541,12 +2543,14 @@ int calc_log_samples(void)
                        next = min(td->o.iops_avg_time, td->o.bw_avg_time);
                        continue;
                }
-               if (td->bw_log && !per_unit_log(td->bw_log)) {
+               if (!td->bw_log ||
+                       (td->bw_log && !per_unit_log(td->bw_log))) {
                        tmp = add_bw_samples(td, &now);
                        if (tmp < next)
                                next = tmp;
                }
-               if (td->iops_log && !per_unit_log(td->iops_log)) {
+               if (!td->iops_log ||
+                       (td->iops_log && !per_unit_log(td->iops_log))) {
                        tmp = add_iops_samples(td, &now);
                        if (tmp < next)
                                next = tmp;