X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=7e3b97966c0b7754cdb10333ffa341a0adf26a5e;hp=c921f5f4379187e5affa6622f360f489b8fce92d;hb=ef6350576b1053b0491b17932dc29740d749ad4a;hpb=7fb28d3661a5833d8be24a014a04ee4548ec1c16 diff --git a/stat.c b/stat.c index c921f5f4..7e3b9796 100644 --- a/stat.c +++ b/stat.c @@ -440,12 +440,14 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts, ts->percentile_list); } if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) { - double p_of_agg; + double p_of_agg = 100.0; const char *bw_str = "KB"; - p_of_agg = mean * 100 / (double) rs->agg[ddir]; - if (p_of_agg > 100.0) - p_of_agg = 100.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 > 999999.9) { min /= 1000.0; @@ -653,9 +655,14 @@ static void show_ddir_status_terse(struct thread_stat *ts, free(ovals); if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) { - double p_of_agg; + double p_of_agg = 100.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; + } - p_of_agg = mean * 100 / (double) rs->agg[ddir]; log_info(";%lu;%lu;%f%%;%f;%f", min, max, p_of_agg, mean, dev); } else log_info(";%lu;%lu;%f%%;%f;%f", 0UL, 0UL, 0.0, 0.0, 0.0); @@ -1313,10 +1320,8 @@ void add_iops_sample(struct thread_data *td, enum fio_ddir ddir, add_stat_sample(&ts->iops_stat[ddir], iops); - if (td->iops_log) { - assert(iops); + if (td->iops_log) add_log_sample(td, td->iops_log, iops, ddir, 0); - } fio_gettime(&td->iops_sample_time, NULL); td->stat_io_blocks[ddir] = td->this_io_blocks[ddir];