[PATCH] Change logging unit from MiB to KiB
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index bd938979f61caa3f59152d50c4eee03b24b84c53..e5d8205598f64428be23a8813203b232a28ab13e 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -1282,6 +1282,22 @@ static int init_io_u(struct thread_data *td)
        return 0;
 }
 
+static void cleanup_allocs(struct thread_data *td)
+{
+       if (td->directory)
+               free(td->directory);
+       if (td->iolog_file)
+               free(td->iolog_file);
+       if (td->exec_prerun)
+               free(td->exec_prerun);
+       if (td->exec_postrun)
+               free(td->exec_postrun);
+       if (td->ioscheduler)
+               free(td->ioscheduler);
+       if (td->sysfs_root)
+               free(td->sysfs_root);
+}
+
 static int create_file(struct thread_data *td, unsigned long long size,
                       int extend)
 {
@@ -1990,18 +2006,7 @@ err:
        }
        if (td->mmap)
                munmap(td->mmap, td->file_size);
-       if (td->directory)
-               free(td->directory);
-       if (td->iolog_file)
-               free(td->iolog_file);
-       if (td->exec_prerun)
-               free(td->exec_prerun);
-       if (td->exec_postrun)
-               free(td->exec_postrun);
-       if (td->ioscheduler)
-               free(td->ioscheduler);
-       if (td->sysfs_root)
-               free(td->sysfs_root);
+       cleanup_allocs(td);
        cleanup_io(td);
        cleanup_io_u(td);
        td_set_runstate(td, TD_EXITED);
@@ -2560,9 +2565,9 @@ static void show_group_stats(struct group_run_stats *rs, int id)
        printf("\nRun status group %d (all jobs):\n", id);
 
        if (rs->max_run[DDIR_READ])
-               printf("   READ: io=%lluMiB, aggrb=%llu, minb=%llu, maxb=%llu, mint=%llumsec, maxt=%llumsec\n", rs->io_mb[0], rs->agg[0], rs->min_bw[0], rs->max_bw[0], rs->min_run[0], rs->max_run[0]);
+               printf("   READ: io=%lluMiB, aggrb=%llu, minb=%llu, maxb=%llu, mint=%llumsec, maxt=%llumsec\n", rs->io_kb[0] >> 10, rs->agg[0], rs->min_bw[0], rs->max_bw[0], rs->min_run[0], rs->max_run[0]);
        if (rs->max_run[DDIR_WRITE])
-               printf("  WRITE: io=%lluMiB, aggrb=%llu, minb=%llu, maxb=%llu, mint=%llumsec, maxt=%llumsec\n", rs->io_mb[1], rs->agg[1], rs->min_bw[1], rs->max_bw[1], rs->min_run[1], rs->max_run[1]);
+               printf("  WRITE: io=%lluMiB, aggrb=%llu, minb=%llu, maxb=%llu, mint=%llumsec, maxt=%llumsec\n", rs->io_kb[1] >> 10, rs->agg[1], rs->min_bw[1], rs->max_bw[1], rs->min_run[1], rs->max_run[1]);
 }
 
 static void show_disk_util(void)
@@ -2638,17 +2643,17 @@ static void show_run_stats(void)
                if (wbw > rs->max_bw[1])
                        rs->max_bw[1] = wbw;
 
-               rs->io_mb[0] += td->io_bytes[0] >> 20;
-               rs->io_mb[1] += td->io_bytes[1] >> 20;
+               rs->io_kb[0] += td->io_bytes[0] >> 10;
+               rs->io_kb[1] += td->io_bytes[1] >> 10;
        }
 
        for (i = 0; i < groupid + 1; i++) {
                rs = &runstats[i];
 
                if (rs->max_run[0])
-                       rs->agg[0] = (rs->io_mb[0]*1024*1000) / rs->max_run[0];
+                       rs->agg[0] = (rs->io_kb[0]*1024) / rs->max_run[0];
                if (rs->max_run[1])
-                       rs->agg[1] = (rs->io_mb[1]*1024*1000) / rs->max_run[1];
+                       rs->agg[1] = (rs->io_kb[1]*1024) / rs->max_run[1];
        }
 
        /*