1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Gregor Kopka <mailfrom-github@kopka.net>
3 Date: Wed, 26 Sep 2018 01:29:16 +0200
4 Subject: [PATCH] Zpool iostat: remove latency/queue scaling
6 Bandwidth and iops are average per second while *_wait are averages
7 per request for latency or, for queue depths, an instantaneous
8 measurement at the end of an interval (according to man zpool).
10 When calculating the first two it makes sense to do
11 x/interval_duration (x being the increase in total bytes or number of
12 requests over the duration of the interval, interval_duration in
13 seconds) to 'scale' from amount/interval_duration to amount/second.
15 But applying the same math for the latter (*_wait latencies/queue) is
16 wrong as there is no interval_duration component in the values (these
17 are time/requests to get to average_time/request or already an
20 This bug leads to the only correct continuous *_wait figures for both
21 latencies and queue depths from 'zpool iostat -l/q' being with
22 duration=1 as then the wrong math cancels itself (x/1 is a nop).
24 This removes temporal scaling from latency and queue depth figures.
26 Reviewed-by: Tony Hutter <hutter2@llnl.gov>
27 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
28 Signed-off-by: Gregor Kopka <gregor@kopka.net>
32 cmd/zpool/zpool_main.c | 12 ++++++------
33 1 file changed, 6 insertions(+), 6 deletions(-)
35 diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
36 index a4fd0321..591e2e5c 100644
37 --- a/cmd/zpool/zpool_main.c
38 +++ b/cmd/zpool/zpool_main.c
39 @@ -3493,7 +3493,7 @@ single_histo_average(uint64_t *histo, unsigned int buckets)
42 print_iostat_queues(iostat_cbdata_t *cb, nvlist_t *oldnv,
43 - nvlist_t *newnv, double scale)
48 @@ -3523,7 +3523,7 @@ print_iostat_queues(iostat_cbdata_t *cb, nvlist_t *oldnv,
49 format = ZFS_NICENUM_1024;
51 for (i = 0; i < ARRAY_SIZE(names); i++) {
52 - val = nva[i].data[0] * scale;
53 + val = nva[i].data[0];
54 print_one_stat(val, format, column_width, cb->cb_scripted);
57 @@ -3532,7 +3532,7 @@ print_iostat_queues(iostat_cbdata_t *cb, nvlist_t *oldnv,
60 print_iostat_latency(iostat_cbdata_t *cb, nvlist_t *oldnv,
61 - nvlist_t *newnv, double scale)
66 @@ -3562,7 +3562,7 @@ print_iostat_latency(iostat_cbdata_t *cb, nvlist_t *oldnv,
67 /* Print our avg latencies on the line */
68 for (i = 0; i < ARRAY_SIZE(names); i++) {
69 /* Compute average latency for a latency histo */
70 - val = single_histo_average(nva[i].data, nva[i].count) * scale;
71 + val = single_histo_average(nva[i].data, nva[i].count);
72 print_one_stat(val, format, column_width, cb->cb_scripted);
74 free_calc_stats(nva, ARRAY_SIZE(names));
75 @@ -3701,9 +3701,9 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
76 print_iostat_default(calcvs, cb, scale);
78 if (cb->cb_flags & IOS_LATENCY_M)
79 - print_iostat_latency(cb, oldnv, newnv, scale);
80 + print_iostat_latency(cb, oldnv, newnv);
81 if (cb->cb_flags & IOS_QUEUES_M)
82 - print_iostat_queues(cb, oldnv, newnv, scale);
83 + print_iostat_queues(cb, oldnv, newnv);
84 if (cb->cb_flags & IOS_ANYHISTO_M) {
86 print_iostat_histos(cb, oldnv, newnv, scale, name);