summaryrefslogtreecommitdiffstats
path: root/usr.sbin/iostat
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2004-02-15 02:45:46 +0000
committertedu <tedu@openbsd.org>2004-02-15 02:45:46 +0000
commit35fa4c39e7e446b9e461e0899753548be778d66a (patch)
tree65098d9e27fadd6ea99b2eb7e25f05c6322f5515 /usr.sbin/iostat
parentbreak in default switch cases (diff)
downloadwireguard-openbsd-35fa4c39e7e446b9e461e0899753548be778d66a.tar.xz
wireguard-openbsd-35fa4c39e7e446b9e461e0899753548be778d66a.zip
new arg to disk_unbusy, to record separate read/write statistics.
looked at by various, testing henning@ mcbride@ dan weeks mostly from netbsd via Pedro Martelletto <pbastos@rdc.puc-rio.br>
Diffstat (limited to 'usr.sbin/iostat')
-rw-r--r--usr.sbin/iostat/iostat.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index a4fbf839650..9b4086ce499 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iostat.c,v 1.18 2003/06/26 19:47:09 deraadt Exp $ */
+/* $OpenBSD: iostat.c,v 1.19 2004/02/15 02:45:47 tedu Exp $ */
/* $NetBSD: iostat.c,v 1.10 1996/10/25 18:21:58 scottr Exp $ */
/*
@@ -265,14 +265,16 @@ double etime;
continue;
/* average Kbytes per transfer. */
- if (cur.dk_xfer[dn])
- mbps = (cur.dk_bytes[dn] / (1024.0)) / cur.dk_xfer[dn];
+ if (cur.dk_rxfer[dn] + cur.dk_wxfer[dn])
+ mbps = ((cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) /
+ (1024.0)) / (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]);
else
mbps = 0.0;
(void)printf(" %5.2f", mbps);
/* average transfers per second. */
- (void)printf(" %3.0f", cur.dk_xfer[dn] / etime);
+ (void)printf(" %3.0f",
+ (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime);
/* time busy in disk activity */
atime = (double)cur.dk_time[dn].tv_sec +
@@ -280,7 +282,8 @@ double etime;
/* Megabytes per second. */
if (atime != 0.0)
- mbps = cur.dk_bytes[dn] / (double)(1024 * 1024);
+ mbps = (cur.dk_rbytes[dn] + cur.dk_wbytes[dn]) /
+ (double)(1024 * 1024);
else
mbps = 0;
(void)printf(" %4.2f ", mbps / etime);
@@ -299,10 +302,12 @@ double etime;
continue;
/* average kbytes per second. */
- (void)printf(" %4.0f", cur.dk_bytes[dn] / (1024.0) / etime);
+ (void)printf(" %4.0f",
+ (cur.dk_rbytes[dn] + cur.dk_wbytes[dn]) / (1024.0) / etime);
/* average transfers per second. */
- (void)printf(" %3.0f", cur.dk_xfer[dn] / etime);
+ (void)printf(" %3.0f",
+ (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime);
/* average time busy in disk activity. */
atime = (double)cur.dk_time[dn].tv_sec +