Skip to content

Commit

Permalink
Zpool iostat: remove latency/queue scaling (#7694)
Browse files Browse the repository at this point in the history
Bandwidth and iops are average per second while *_wait are averages
per request for latency or, for queue depths, an instantaneous
measurement at the end of an interval (according to man zpool).

When calculating the first two it makes sense to do
x/interval_duration (x being the increase in total bytes or number of
requests over the duration of the interval, interval_duration in
seconds) to 'scale' from amount/interval_duration to amount/second.

But applying the same math for the latter (*_wait latencies/queue) is
wrong as there is no interval_duration component in the values (these
are time/requests to get to average_time/request or already an
absulute number).

This bug leads to the only correct continuous *_wait figures for both
latencies and queue depths from 'zpool iostat -l/q' being with
duration=1 as then the wrong math cancels itself (x/1 is a nop).

This removes temporal scaling from latency and queue depth figures.
Closes: #7694

Signed-off-by: Gregor Kopka <gregor@kopka.net>
  • Loading branch information
Gregor Kopka committed Sep 22, 2018
1 parent dda5500 commit 9e9b0d2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/zpool/zpool_main.c
Expand Up @@ -3755,7 +3755,7 @@ single_histo_average(uint64_t *histo, unsigned int buckets)

static void
print_iostat_queues(iostat_cbdata_t *cb, nvlist_t *oldnv,
nvlist_t *newnv, double scale)
nvlist_t *newnv)
{
int i;
uint64_t val;
Expand Down Expand Up @@ -3785,7 +3785,7 @@ print_iostat_queues(iostat_cbdata_t *cb, nvlist_t *oldnv,
format = ZFS_NICENUM_1024;

for (i = 0; i < ARRAY_SIZE(names); i++) {
val = nva[i].data[0] * scale;
val = nva[i].data[0];
print_one_stat(val, format, column_width, cb->cb_scripted);
}

Expand All @@ -3794,7 +3794,7 @@ print_iostat_queues(iostat_cbdata_t *cb, nvlist_t *oldnv,

static void
print_iostat_latency(iostat_cbdata_t *cb, nvlist_t *oldnv,
nvlist_t *newnv, double scale)
nvlist_t *newnv)
{
int i;
uint64_t val;
Expand Down Expand Up @@ -3824,7 +3824,7 @@ print_iostat_latency(iostat_cbdata_t *cb, nvlist_t *oldnv,
/* Print our avg latencies on the line */
for (i = 0; i < ARRAY_SIZE(names); i++) {
/* Compute average latency for a latency histo */
val = single_histo_average(nva[i].data, nva[i].count) * scale;
val = single_histo_average(nva[i].data, nva[i].count);
print_one_stat(val, format, column_width, cb->cb_scripted);
}
free_calc_stats(nva, ARRAY_SIZE(names));
Expand Down Expand Up @@ -3972,9 +3972,9 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
print_iostat_default(calcvs, cb, scale);
}
if (cb->cb_flags & IOS_LATENCY_M)
print_iostat_latency(cb, oldnv, newnv, scale);
print_iostat_latency(cb, oldnv, newnv);
if (cb->cb_flags & IOS_QUEUES_M)
print_iostat_queues(cb, oldnv, newnv, scale);
print_iostat_queues(cb, oldnv, newnv);
if (cb->cb_flags & IOS_ANYHISTO_M) {
printf("\n");
print_iostat_histos(cb, oldnv, newnv, scale, name);
Expand Down

0 comments on commit 9e9b0d2

Please sign in to comment.