On Sat, Aug 08, 2020 at 04:12:31AM +0200, Klemens Nanni wrote:
> This is OK with me as it fixes the default view, but I think other views
> need fixing as well, e.g.
>
> $ iostat -I
> ttysd0 sd1
> cpu
> tin tout KB/t xfr MB KB/t xfr MB us ni sy sp in
> id
> 178524 22139320 26.99 10698431 281987.61 11.78 7582117 87218.82 7 0
> 3 1 0 88
That was a bad example since `-I' shows the running total, hence values
that only ever increase and most likely change in magnitude.
> I'm testing with `dd if=/dev/rsd0c of=/dev/null bs=1m' on a X230 with
> sd0 at scsibus1 targ 0 lun 0:
> naa.5002538d410a7bce
> I don't have that fast disks at hand, but expanding it by another column
> makes sense to me and could further simplify some of the code.
Here's a diff that expands `-d' (done by default) showing MB values by
two columns and `-D' showing KB values by one column; `-I' is not
changed for above mentioned reasons.
This seems consistent to me on all disk related views and leaves room
for faster disks, should they ever read/write faster than 1000 MB/s.
Running with above `dd' to get reads, here's the visible change of this
diff:
$ iostat -c2
tty sd0 sd1cpu
tin tout KB/t t/s MB/s KB/t t/s MB/s us ni sy sp in id
2 394 60.83 285 16.90 18.43 20 0.36 4 0 3 1 0 91
1 195 63.97 3954 247.00 2.002 0.00 0 0 11 0 0 89
$ ./obj/iostat -c2
ttysd0 sd1cpu
tin tout KB/t t/sMB/s KB/t t/sMB/s us ni sy sp in id
2 393 60.94 294 17.51 18.43 200.36 4 0 3 1 0 91
1 205 64.00 3560 222.52 0.0000.00 0 0 14 1 2 83
$ iostat -d -c2
sd0 sd1
KB/t t/s MB/s KB/t t/s MB/s
61.02 301 17.96 18.43 20 0.35
64.00 3613 225.81 0.000 0.00
$ ./obj/iostat -d -c2
sd0 sd1
KB/t t/sMB/s KB/t t/sMB/s
61.06 305 18.18 18.43 200.35
64.00 3602 225.12 0.0000.00
$ iostat -D -c2
sd0 sd1
KB xfr time KB xfr time
19260 315 0.04 362 20 0.00
230590 3603 0.48 00 0.00
$ ./obj/iostat -D -c2
sd0sd1
KB xfr time KB xfr time
19708 322 0.04 361 20 0.00
24 3750 0.5000 0.00
Feedback? OK?
Index: iostat.c
===
RCS file: /cvs/src/usr.sbin/iostat/iostat.c,v
retrieving revision 1.42
diff -u -p -r1.42 iostat.c
--- iostat.c14 Oct 2019 19:22:17 - 1.42
+++ iostat.c9 Aug 2020 22:04:21 -
@@ -224,15 +224,12 @@ header(void)
if (ISSET(todo, SHOW_STATS_1))
for (i = 0; i < dk_ndrive; i++)
if (cur.dk_select[i]) {
- if (ISSET(todo, SHOW_TOTALS))
- printf(" %18.18s ", cur.dk_name[i]);
- else
- printf(" %16.16s ", cur.dk_name[i]);
+ printf(" %18.18s ", cur.dk_name[i]);
}
if (ISSET(todo, SHOW_STATS_2))
for (i = 0; i < dk_ndrive; i++)
if (cur.dk_select[i])
- printf(" %16.16s ", cur.dk_name[i]);
+ printf(" %17.17s ", cur.dk_name[i]);
if (ISSET(todo, SHOW_CPU))
printf(" cpu");
@@ -252,12 +249,12 @@ header(void)
if (ISSET(todo, SHOW_TOTALS))
printf(" KB/t xfr MB ");
else
- printf(" KB/t t/s MB/s ");
+ printf(" KB/t t/sMB/s ");
}
if (ISSET(todo, SHOW_STATS_2))
for (i = 0; i < dk_ndrive; i++)
if (cur.dk_select[i])
- printf(" KB xfr time ");
+ printf(" KB xfr time ");
if (ISSET(todo, SHOW_CPU))
printf(" us ni sy sp in id");
@@ -302,7 +299,7 @@ disk_stats(double etime)
if (ISSET(todo, SHOW_TOTALS))
printf(" %6.2f ", mbps / etime);
else
- printf(" %5.2f ", mbps / etime);
+ printf(" %7.2f ", mbps / etime);
}
}
@@ -317,7 +314,7 @@ disk_stats2(double etime)