[PATCH 16/24] wmifs: Throw out first /proc/net/dev reading.

Doug Torrance <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
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/wmifs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/wmifs/wmifs.c b/wmifs/wmifs.c
index 07097f2..64f8b67 100644
--- a/wmifs/wmifs.c
+++ b/wmifs/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))
-- 
2.1.4


-- 
To unsubscribe, send mail to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.