nanosecond: reconcile terse output with nanosecond timing for latencies
authorVincent Fu <Vincent.Fu@sandisk.com>
Tue, 21 Mar 2017 15:22:08 +0000 (11:22 -0400)
committerVincent Fu <vincent.fu@sandisk.com>
Wed, 21 Jun 2017 14:41:21 +0000 (10:41 -0400)
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.

HOWTO
stat.c

diff --git a/HOWTO b/HOWTO
index d3a578378ab49e43e89fd33be9cdc6046b22e674..22c5a5b8e1d845b726a2e860f5446057ff19c42e 100644 (file)
--- 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 28acf103c7ef02d3951f932eacb6ce18a11504a8..4e671d0f073d63e2053f65d96ec70859af664798 100644 (file)
--- 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*/