change fio_set_odirect() prototype not to use int fd
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index beec574d8bd4e80767e683f5631e838d6df853d1..91c74abef420f8fb0e8453e5a9be1fecff1e6f56 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -100,7 +100,8 @@ static unsigned int plat_val_to_idx(unsigned long long val)
  */
 static unsigned long long plat_idx_to_val(unsigned int idx)
 {
-       unsigned int error_bits, k, base;
+       unsigned int error_bits;
+       unsigned long long k, base;
 
        assert(idx < FIO_IO_U_PLAT_NR);
 
@@ -111,7 +112,7 @@ static unsigned long long plat_idx_to_val(unsigned int idx)
 
        /* Find the group and compute the minimum value of that group */
        error_bits = (idx >> FIO_IO_U_PLAT_BITS) - 1;
-       base = 1 << (error_bits + FIO_IO_U_PLAT_BITS);
+       base = ((unsigned long long) 1) << (error_bits + FIO_IO_U_PLAT_BITS);
 
        /* Find its bucket number of the group */
        k = idx % FIO_IO_U_PLAT_VAL;
@@ -475,6 +476,12 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
                else
                        bw_str = "kB";
 
+               if (rs->agg[ddir]) {
+                       p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024);
+                       if (p_of_agg > 100.0)
+                               p_of_agg = 100.0;
+               }
+
                if (rs->unit_base == 1) {
                        min *= 8.0;
                        max *= 8.0;
@@ -482,12 +489,6 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
                        dev *= 8.0;
                }
 
-               if (rs->agg[ddir]) {
-                       p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024);
-                       if (p_of_agg > 100.0)
-                               p_of_agg = 100.0;
-               }
-
                if (mean > fkb_base * fkb_base) {
                        min /= fkb_base;
                        max /= fkb_base;
@@ -520,7 +521,7 @@ static int show_lat(double *io_u_lat, int nr, const char **ranges,
                if (new_line) {
                        if (line)
                                log_buf(out, "\n");
-                       log_buf(out, "    lat (%s) : ", msg);
+                       log_buf(out, "  lat (%s)   : ", msg);
                        new_line = 0;
                        line = 0;
                }
@@ -924,7 +925,7 @@ static void show_ddir_status_terse(struct thread_stat *ts,
                double p_of_agg = 100.0;
 
                if (rs->agg[ddir]) {
-                       p_of_agg = mean * 100 / (double) rs->agg[ddir];
+                       p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024);
                        if (p_of_agg > 100.0)
                                p_of_agg = 100.0;
                }
@@ -1055,7 +1056,7 @@ static void add_ddir_status_json(struct thread_stat *ts,
 
        if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
                if (rs->agg[ddir]) {
-                       p_of_agg = mean * 100 / (double) rs->agg[ddir];
+                       p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024);
                        if (p_of_agg > 100.0)
                                p_of_agg = 100.0;
                }