summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-01-10 23:29:42 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-01-10 23:29:42 +0000
commit8c16cd159ed70acb154b18b1413d0cf6d0074114 (patch)
treea5d785b118b4099576208950b382948d6a3e4085 /usr.bin
parentd361e8768ae1f4dc915e9c8f576922a4c471742c (diff)
fix the time view of the interface stats so that is shows the average
over the refresh interval (like the manpage says it should) instead of the total. ok markus@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/systat/if.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/systat/if.c b/usr.bin/systat/if.c
index e27bd8b3df8..5fbd4f53b2a 100644
--- a/usr.bin/systat/if.c
+++ b/usr.bin/systat/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.3 2005/12/13 09:52:20 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.4 2006/01/10 23:29:41 dlg Exp $ */
/*
* Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
*
@@ -47,6 +47,7 @@ struct ifstat {
} *ifstats;
static int nifs = 0;
+extern int naptime;
WINDOW *
openifstat(void)
@@ -77,9 +78,11 @@ initifstat(void)
#define UPDATE(x, y) do { \
ifs->ifs_now.x = ifm.y; \
ifs->ifs_cur.x = ifs->ifs_now.x - ifs->ifs_old.x; \
- sum.x += ifs->ifs_cur.x; \
- if (state == TIME) \
+ if (state == TIME) {\
ifs->ifs_old.x = ifs->ifs_now.x; \
+ ifs->ifs_cur.x /= naptime; \
+ } \
+ sum.x += ifs->ifs_cur.x; \
} while(0)