X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=91c74abef420f8fb0e8453e5a9be1fecff1e6f56;hp=d496e8f968fee2f47d761f4c9e244e6c6ad08744;hb=6c3169f9cbe179a89bbbaa9de26e54711d027e99;hpb=29eb371b1d2b436e252c6e3e20981d88f7b1cd3f diff --git a/stat.c b/stat.c index d496e8f9..91c74abe 100644 --- 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]; - 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; }