diff options
author | Tony Hutter <[email protected]> | 2017-06-22 09:39:01 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-06-22 09:39:01 -0700 |
commit | 29eb4942856da942f1482cba9326698f91eb8c1c (patch) | |
tree | 53f4fcb43dfce3ecb74b598fa04898c5b4114db8 /lib/libzfs | |
parent | d9ad3fea3bd0368b6af0b08ccc4de1b080e2bcb7 (diff) |
Dashes for zero latency values in zpool iostat -p
This prints dashes instead of zeros for zero latency values in
'zpool iostat -p'. You'll get zero latencies reported when the
disk is idle, but technically a zero latency is invalid, since you
can't measure the latency of doing nothing.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #6210
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_util.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index c281f9eb3..1fb7b5ee5 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -623,9 +623,14 @@ zfs_nicenum_format(uint64_t num, char *buf, size_t buflen, if (format == ZFS_NICENUM_RAW) { snprintf(buf, buflen, "%llu", (u_longlong_t)num); return; + } else if (format == ZFS_NICENUM_RAWTIME && num > 0) { + snprintf(buf, buflen, "%llu", (u_longlong_t)num); + return; + } else if (format == ZFS_NICENUM_RAWTIME && num == 0) { + snprintf(buf, buflen, "%s", "-"); + return; } - while (n >= k_unit[format] && index < units_len[format]) { n /= k_unit[format]; index++; @@ -633,7 +638,7 @@ zfs_nicenum_format(uint64_t num, char *buf, size_t buflen, u = units[format][index]; - /* Don't print 0ns times */ + /* Don't print zero latencies since they're invalid */ if ((format == ZFS_NICENUM_TIME) && (num == 0)) { (void) snprintf(buf, buflen, "-"); } else if ((index == 0) || ((num % |