can we afford an extra column in iostat?
Giorgos Keramidas
keramida at freebsd.org
Tue Jul 14 04:37:21 UTC 2009
While converting my laptop's main disk to zfs, I noticed iostat output
like this (bits copied from here and there):
| keramida at kobe:/home/keramida$ iostat -w3 ad0 da0
| tty ad0 da0 cpu
| tin tout KB/t tps MB/s KB/t tps MB/s us ni sy in id
| 5 2119 36.29 56 2.00 54.95 7 0.35 3 0 8 0 89
| 0 9478 10.90 290 3.09 57.22 12 0.67 42 0 43 0 15
| 012595 1.72 213 0.36 21.36 80 1.66 48 0 48 0 4
| 050042 4.56 715 3.19 11.44 164 1.83 29 0 50 1 20
| 11529568 7.34 443 3.17 16.97 165 2.74 31 0 53 0 16
| 33835534 7.61 211 1.57 7.31 295 2.11 36 0 55 1 9
| 38636874 3.10 186 0.56 6.63 309 2.00 37 0 56 0 7
| 24239726 2.54 196 0.49 6.13 336 2.01 36 0 56 0 8
| 17136654 0.57 192 0.11 7.97 305 2.37 34 0 56 0 9
| 23439020 0.76 195 0.15 7.02 333 2.28 32 0 57 1 11
| 43733189 2.52 192 0.47 6.99 269 1.84 37 0 57 1 5
| 36232178 5.48 193 1.03 6.78 268 1.77 38 0 54 0 8
| 43226266 34.19 228 7.61 6.94 253 1.72 32 0 49 1 19
The default output of iostat, when no disks are specified is a bit wider
than this, reaching column 75 here:
1 2 3 4 5 6 7
12345678901234567890123456789012345678901234567890123456789012345678901234567890
---------------------------------------------------------------------------
tty ad0 md0 da0 cpu
tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id
6 2315 34.97 58 1.99 6.46 0 0.00 47.41 8 0.37 4 0 8 0 88
But there's still a bit of space before column 80, so can we afford an
extra space between tin/tout to make the output look more like this?
| $ ./iostat -w2
| tty ad0 md0 da0 cpu
| tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id
| 7 2570 32.92 62 1.98 6.46 0 0.00 43.44 10 0.41 4 0 9 0 87
| 0 36506 0.99 507 0.49 0.00 0 0.00 20.13 155 3.04 34 0 56 1 9
| 0 16695 0.83 226 0.18 0.00 0 0.00 26.16 97 2.48 35 0 56 0 9
| 0 24158 10.63 428 4.45 0.00 0 0.00 14.44 137 1.93 32 0 51 0 17
| ^C
The patch that changes this is quite small:
%%%
diff -r 0f182a7399e8 usr.sbin/iostat/iostat.c
--- a/usr.sbin/iostat/iostat.c Sun Jul 12 09:34:48 2009 +0300
+++ b/usr.sbin/iostat/iostat.c Tue Jul 14 07:20:41 2009 +0300
@@ -586,7 +586,7 @@
}
if (xflag == 0 && Tflag > 0)
- printf("%4.0Lf%5.0Lf", cur.tk_nin / etime,
+ printf("%4.0Lf %5.0Lf", cur.tk_nin / etime,
cur.tk_nout / etime);
devstats(hflag, etime, havelast);
@@ -696,7 +696,7 @@
(void)printf("\n");
if (Tflag > 0)
- (void)printf(" tin tout");
+ (void)printf(" tin tout");
for (i=0, printed = 0;(i < num_devices) && (printed < maxshowdevs);i++){
if ((dev_select[i].selected != 0)
@@ -754,7 +754,7 @@
"device r/i w/i kr/i kw/i wait svc_t %%b "
);
if (Tflag > 0)
- printf("tin tout ");
+ printf("tin tout ");
if (Cflag > 0)
printf("us ni sy in id ");
printf("\n");
@@ -895,7 +895,7 @@
*/
printf("%52s","");
if (Tflag > 0)
- printf("%4.0Lf%5.0Lf", cur.tk_nin / etime,
+ printf("%4.0Lf %5.0Lf", cur.tk_nin / etime,
cur.tk_nout / etime);
if (Cflag > 0)
cpustats();
%%%
More information about the freebsd-hackers
mailing list