From: Vincent Fu Date: Tue, 21 Mar 2017 15:22:08 +0000 (-0400) Subject: nanosecond: reconcile terse output with nanosecond timing for latencies X-Git-Tag: fio-2.99~72^2~1^2~9 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=247823cc9f4032eaa5f75c9883727c91401bee44;hp=d6bb626ef37d3905221ade2887b422717a07af09;ds=sidebyside nanosecond: reconcile terse output with nanosecond timing for latencies The terse output format is unchanged and latencies are still reported as usec. Completion latencies are tracked with nsec precision in io_u_lat_n. Put these latencies in the first microsecond latency bucket which is where they would have fallen before the change to nsec timing. --- diff --git a/HOWTO b/HOWTO index d3a57837..22c5a5b8 100644 --- a/HOWTO +++ b/HOWTO @@ -3189,7 +3189,7 @@ Split up, the format is as follows: Total IO (KiB), bandwidth (KiB/sec), IOPS, runtime (msec) Submission latency: min, max, mean, stdev (usec) - Completion latency: min, max, mean, stdev(usec) + Completion latency: min, max, mean, stdev (usec) Completion latency percentiles: 20 fields (see below) Total latency: min, max, mean, stdev (usec) Bw (KiB/s): min, max, aggregate percentage of total, mean, stdev diff --git a/stat.c b/stat.c index 28acf103..4e671d0f 100644 --- a/stat.c +++ b/stat.c @@ -358,6 +358,23 @@ static void stat_calc_lat(struct thread_stat *ts, double *dst, } } +/* + * To keep the terse format unaltered, add all of the ns latency + * buckets to the first us latency bucket + */ +void stat_calc_lat_nu(struct thread_stat *ts, double *io_u_lat_u) +{ + unsigned long ntotal = 0, total = ddir_rw_sum(ts->total_io_u); + int i; + + stat_calc_lat(ts, io_u_lat_u, ts->io_u_lat_u, FIO_IO_U_LAT_U_NR); + + for (i = 0; i < FIO_IO_U_LAT_N_NR; i++) + ntotal += ts->io_u_lat_n[i]; + + io_u_lat_u[0] += 100.0 * (double) ntotal / (double) total; +} + void stat_calc_lat_n(struct thread_stat *ts, double *io_u_lat) { stat_calc_lat(ts, io_u_lat, ts->io_u_lat_n, FIO_IO_U_LAT_N_NR); @@ -860,12 +877,12 @@ static void show_ddir_status_terse(struct thread_stat *ts, (unsigned long long) ts->runtime[ddir]); if (calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev)) - log_buf(out, ";%llu;%llu;%f;%f", min, max, mean, dev); + log_buf(out, ";%llu;%llu;%f;%f", min/1000, max/1000, mean/1000, dev/1000); else log_buf(out, ";%llu;%llu;%f;%f", 0ULL, 0ULL, 0.0, 0.0); if (calc_lat(&ts->clat_stat[ddir], &min, &max, &mean, &dev)) - log_buf(out, ";%llu;%llu;%f;%f", min, max, mean, dev); + log_buf(out, ";%llu;%llu;%f;%f", min/1000, max/1000, mean/1000, dev/1000); else log_buf(out, ";%llu;%llu;%f;%f", 0ULL, 0ULL, 0.0, 0.0); @@ -882,11 +899,11 @@ static void show_ddir_status_terse(struct thread_stat *ts, log_buf(out, ";0%%=0"); continue; } - log_buf(out, ";%f%%=%llu", ts->percentile_list[i].u.f, ovals[i]); + log_buf(out, ";%f%%=%llu", ts->percentile_list[i].u.f, ovals[i]/1000); } if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev)) - log_buf(out, ";%llu;%llu;%f;%f", min, max, mean, dev); + log_buf(out, ";%llu;%llu;%f;%f", min/1000, max/1000, mean/1000, dev/1000); else log_buf(out, ";%llu;%llu;%f;%f", 0ULL, 0ULL, 0.0, 0.0); @@ -1067,7 +1084,7 @@ static void show_thread_status_terse_v2(struct thread_stat *ts, /* Calc % distribution of IO depths, usecond, msecond latency */ stat_calc_dist(ts->io_u_map, ddir_rw_sum(ts->total_io_u), io_u_dist); - stat_calc_lat_u(ts, io_u_lat_u); + stat_calc_lat_nu(ts, io_u_lat_u); stat_calc_lat_m(ts, io_u_lat_m); /* Only show fixed 7 I/O depth levels*/ @@ -1132,7 +1149,7 @@ static void show_thread_status_terse_v3_v4(struct thread_stat *ts, /* Calc % distribution of IO depths, usecond, msecond latency */ stat_calc_dist(ts->io_u_map, ddir_rw_sum(ts->total_io_u), io_u_dist); - stat_calc_lat_u(ts, io_u_lat_u); + stat_calc_lat_nu(ts, io_u_lat_u); stat_calc_lat_m(ts, io_u_lat_m); /* Only show fixed 7 I/O depth levels*/