[Pkg-wmaker-commits] [wmifs] 91/118: wmifs: Throw out first /proc/net/dev reading.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 27 02:37:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmifs.

commit 100f69e043dde04158c25e72ba2050c795d8c08c
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Wed May 27 17:33:25 2015 -0500

    wmifs: Throw out first /proc/net/dev reading.
    
    If we keep it, we start with a huge spike and everything else is zero
    until the spike finally leaves the window several moments later.
---
 wmifs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/wmifs.c b/wmifs.c
index 07097f2..64f8b67 100644
--- a/wmifs.c
+++ b/wmifs.c
@@ -419,6 +419,7 @@ void wmifs_routine(int argc, char **argv)
 
 	int			stat_online;
 	int			stat_current;
+	int			first_time = 1;
 
 	unsigned int	curtime;
 	unsigned int	nexttime;
@@ -545,9 +546,13 @@ draw_window:
 
 		for (i = 0; i < stat_online; i++) {
 			get_statistics(stat_devices[i].name, &ipacket, &opacket, &istat, &ostat);
-			stat_devices[i].his[53][0] += istat - stat_devices[i].istatlast;
-			stat_devices[i].his[53][1] += ostat - stat_devices[i].ostatlast;
 
+			if (first_time) {
+				first_time = 0;
+			} else {
+				stat_devices[i].his[53][0] += istat - stat_devices[i].istatlast;
+				stat_devices[i].his[53][1] += ostat - stat_devices[i].ostatlast;
+			}
 
 			if (i == stat_current) {
 				if (!stillonline(stat_devices[i].name))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmifs.git



More information about the Pkg-wmaker-commits mailing list