X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=stat.c;h=63353cc0cd2bb496de27d6bda796ab130cb285d5;hb=aa6cb4598cfde5a1c3f58e39160a2b2b99369625;hp=d496e8f968fee2f47d761f4c9e244e6c6ad08744;hpb=29eb371b1d2b436e252c6e3e20981d88f7b1cd3f;p=fio.git diff --git a/stat.c b/stat.c index d496e8f9..63353cc0 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; } @@ -2158,7 +2159,7 @@ static void __add_log_sample(struct io_log *iolog, union io_sample_data data, if (iolog->disabled) return; if (flist_empty(&iolog->io_logs)) - iolog->avg_last = t; + iolog->avg_last[ddir] = t; cur_log = get_cur_log(iolog); if (cur_log) { @@ -2289,9 +2290,9 @@ static long add_log_sample(struct thread_data *td, struct io_log *iolog, * If period hasn't passed, adding the above sample is all we * need to do. */ - this_window = elapsed - iolog->avg_last; - if (elapsed < iolog->avg_last) - return iolog->avg_last - elapsed; + this_window = elapsed - iolog->avg_last[ddir]; + if (elapsed < iolog->avg_last[ddir]) + return iolog->avg_last[ddir] - elapsed; else if (this_window < iolog->avg_msec) { int diff = iolog->avg_msec - this_window; @@ -2299,9 +2300,9 @@ static long add_log_sample(struct thread_data *td, struct io_log *iolog, return diff; } - _add_stat_to_log(iolog, elapsed, td->o.log_max != 0); + __add_stat_to_log(iolog, ddir, elapsed, td->o.log_max != 0); - iolog->avg_last = elapsed - (this_window - iolog->avg_msec); + iolog->avg_last[ddir] = elapsed - (this_window - iolog->avg_msec); return iolog->avg_msec; }