summaryrefslogtreecommitdiff
path: root/usr.sbin/iostat
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-02-13 08:46:37 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-02-13 08:46:37 +0000
commit594c2e9d6a43ae32bd3989926e09192b9d374a6b (patch)
tree8f09621d7cd0488c93b797cf1bc6689d12abca30 /usr.sbin/iostat
parent69108aea1f052aa3b7b5abd3849e7bcd0ec3d9d5 (diff)
totals tend to be larger, give them some more room to breathe
Diffstat (limited to 'usr.sbin/iostat')
-rw-r--r--usr.sbin/iostat/iostat.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index d7cbfc5b15d..2f65cfd50fa 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iostat.c,v 1.32 2013/11/23 22:51:42 deraadt Exp $ */
+/* $OpenBSD: iostat.c,v 1.33 2014/02/13 08:46:36 tedu Exp $ */
/* $NetBSD: iostat.c,v 1.10 1996/10/25 18:21:58 scottr Exp $ */
/*
@@ -205,12 +205,18 @@ header(void)
/* Main Headers. */
if (ISSET(todo, SHOW_TTY))
- printf(" tty");
+ if (ISSET(todo, SHOW_TOTALS))
+ printf(" tty");
+ else
+ printf(" tty");
if (ISSET(todo, SHOW_STATS_1))
for (i = 0; i < dk_ndrive; i++)
if (cur.dk_select[i])
- printf(" %16.16s ", cur.dk_name[i]);
+ if (ISSET(todo, SHOW_TOTALS))
+ printf(" %18.18s ", cur.dk_name[i]);
+ else
+ printf(" %16.16s ", cur.dk_name[i]);
if (ISSET(todo, SHOW_STATS_2))
for (i = 0; i < dk_ndrive; i++)
if (cur.dk_select[i])
@@ -222,13 +228,16 @@ header(void)
/* Sub-Headers. */
if (ISSET(todo, SHOW_TTY))
- printf(" tin tout");
+ if (ISSET(todo, SHOW_TOTALS))
+ printf(" tin tout");
+ else
+ printf(" tin tout");
if (ISSET(todo, SHOW_STATS_1))
for (i = 0; i < dk_ndrive; i++)
if (cur.dk_select[i]) {
if (ISSET(todo, SHOW_TOTALS))
- printf(" KB/t xfr MB ");
+ printf(" KB/t xfr MB ");
else
printf(" KB/t t/s MB/s ");
}
@@ -262,7 +271,10 @@ disk_stats(double etime)
printf(" %5.2f", mbps);
/* average transfers per second. */
- printf(" %4.0f", (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime);
+ if (ISSET(todo, SHOW_TOTALS))
+ printf(" %5.0f", (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime);
+ else
+ printf(" %4.0f", (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime);
/* time busy in disk activity */
atime = (double)cur.dk_time[dn].tv_sec +
@@ -274,7 +286,10 @@ disk_stats(double etime)
(double)(1024 * 1024);
else
mbps = 0;
- printf(" %5.2f ", mbps / etime);
+ if (ISSET(todo, SHOW_TOTALS))
+ printf(" %6.2f ", mbps / etime);
+ else
+ printf(" %5.2f ", mbps / etime);
}
}
@@ -347,7 +362,12 @@ display(void)
etime = 1.0;
if (ISSET(todo, SHOW_TTY))
- printf("%4.0f %4.0f", cur.tk_nin / etime, cur.tk_nout / etime);
+ if (ISSET(todo, SHOW_TOTALS))
+ printf("%6.0f %8.0f", cur.tk_nin / etime,
+ cur.tk_nout / etime);
+ else
+ printf("%4.0f %4.0f", cur.tk_nin / etime,
+ cur.tk_nout / etime);
if (ISSET(todo, SHOW_STATS_1))
disk_stats(etime);