X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=stat.c;h=8a0fab0548f8821202c76cb610ea345e4c2bc6f0;hb=525c2bfabdb7e0093a8775a09ad3e772d962760e;hp=c52620d374f01f7c51241a971c018a4722e60914;hpb=90fef2d162fba55ad684c2c80b3b9739b8d16e72;p=fio.git diff --git a/stat.c b/stat.c index c52620d3..8a0fab05 100644 --- a/stat.c +++ b/stat.c @@ -210,6 +210,22 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts, free(minp); free(maxp); } + if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev)) { + const char *base = "(usec)"; + char *minp, *maxp; + + if (!usec_to_msec(&min, &max, &mean, &dev)) + base = "(msec)"; + + minp = num2str(min, 6, 1, 0); + maxp = num2str(max, 6, 1, 0); + + log_info(" lat %s: min=%s, max=%s, avg=%5.02f," + " stdev=%5.02f\n", base, minp, maxp, mean, dev); + + free(minp); + free(maxp); + } if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) { double p_of_agg; @@ -371,6 +387,11 @@ static void show_ddir_status_terse(struct thread_stat *ts, else log_info(";%lu;%lu;%f;%f", 0UL, 0UL, 0.0, 0.0); + if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev)) + log_info(";%lu;%lu;%f;%f", min, max, mean, dev); + else + log_info(";%lu;%lu;%f;%f", 0UL, 0UL, 0.0, 0.0); + if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) { double p_of_agg; @@ -380,6 +401,7 @@ static void show_ddir_status_terse(struct thread_stat *ts, log_info(";%lu;%lu;%f%%;%f;%f", 0UL, 0UL, 0.0, 0.0, 0.0); } +#define FIO_TERSE_VERSION "2" static void show_thread_status_terse(struct thread_stat *ts, struct group_run_stats *rs) @@ -390,7 +412,8 @@ static void show_thread_status_terse(struct thread_stat *ts, double usr_cpu, sys_cpu; int i; - log_info("%s;%d;%d", ts->name, ts->groupid, ts->error); + log_info("%s;%s;%d;%d", FIO_TERSE_VERSION, ts->name, ts->groupid, + ts->error); show_ddir_status_terse(ts, rs, 0); show_ddir_status_terse(ts, rs, 1); @@ -498,6 +521,7 @@ void show_run_stats(void) memset(ts, 0, sizeof(*ts)); for (j = 0; j <= DDIR_WRITE; j++) { + ts->lat_stat[j].min_val = -1UL; ts->clat_stat[j].min_val = -1UL; ts->slat_stat[j].min_val = -1UL; ts->bw_stat[j].min_val = -1UL; @@ -559,6 +583,7 @@ void show_run_stats(void) for (l = 0; l <= DDIR_WRITE; l++) { sum_stat(&ts->clat_stat[l], &td->ts.clat_stat[l], idx); sum_stat(&ts->slat_stat[l], &td->ts.slat_stat[l], idx); + sum_stat(&ts->lat_stat[l], &td->ts.lat_stat[l], idx); sum_stat(&ts->bw_stat[l], &td->ts.bw_stat[l], idx); ts->stat_io_bytes[l] += td->ts.stat_io_bytes[l]; @@ -644,7 +669,7 @@ void show_run_stats(void) * don't overwrite last signal output */ if (!terse_output) - printf("\n"); + log_info("\n"); for (i = 0; i < nr_ts; i++) { ts = &threadstats[i]; @@ -742,6 +767,17 @@ void add_slat_sample(struct thread_data *td, enum fio_ddir ddir, add_log_sample(td, ts->slat_log, usec, ddir, bs); } +void add_lat_sample(struct thread_data *td, enum fio_ddir ddir, + unsigned long usec, unsigned int bs) +{ + struct thread_stat *ts = &td->ts; + + add_stat_sample(&ts->lat_stat[ddir], usec); + + if (ts->lat_log) + add_log_sample(td, ts->lat_log, usec, ddir, bs); +} + void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs, struct timeval *t) { @@ -752,7 +788,8 @@ void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs, if (spent < td->o.bw_avg_time) return; - rate = (td->this_io_bytes[ddir] - ts->stat_io_bytes[ddir]) * 1000 / spent / 1024; + rate = (td->this_io_bytes[ddir] - ts->stat_io_bytes[ddir]) * + 1000 / spent / 1024; add_stat_sample(&ts->bw_stat[ddir], rate); if (ts->bw_log)