From: Sitsofe Wheeler Date: Tue, 27 Jun 2017 06:21:32 +0000 (+0100) Subject: stat: further group percentage fixes X-Git-Tag: fio-2.99~16 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=d170747454857f9ed842cf573327c696bc5831c8;p=fio.git stat: further group percentage fixes db84b73bd7b0c3b718596fbeb6a5f940b05a6735 forgot to fix the group percentage calculation when using json or terse output. It also did its caculation after the mean's base might have been changed to bits but the aggregate bandwidth's unit is (k)bytes. Fix these. Signed-off-by: Sitsofe Wheeler --- diff --git a/stat.c b/stat.c index beec574d..aebd1071 100644 --- a/stat.c +++ b/stat.c @@ -475,6 +475,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 +488,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; @@ -924,7 +924,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 +1055,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; }