diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2006-01-10 23:29:42 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2006-01-10 23:29:42 +0000 |
commit | 8c16cd159ed70acb154b18b1413d0cf6d0074114 (patch) | |
tree | a5d785b118b4099576208950b382948d6a3e4085 /usr.bin/systat | |
parent | d361e8768ae1f4dc915e9c8f576922a4c471742c (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/systat')
-rw-r--r-- | usr.bin/systat/if.c | 9 |
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) |