Graph lines logging can handle longer logfiles and has a safety limit.

Thu, 20 Aug 2015 14:32:56 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 20 Aug 2015 14:32:56 +0200
changeset 389
584d40bb4b09
parent 388
05a55609cd9a
child 390
daa435544ab1

Graph lines logging can handle longer logfiles and has a safety limit.

thermferm/server.c file | annotate | diff | comparison | revisions
--- a/thermferm/server.c	Wed Aug 19 22:09:17 2015 +0200
+++ b/thermferm/server.c	Thu Aug 20 14:32:56 2015 +0200
@@ -53,9 +53,9 @@
 #define SS_BUFSIZE      1024
 #define SS_TIMEOUT      300
 
-#define	MAX_INTERVALS	6
-const int	GRAPH_INTERVAL[MAX_INTERVALS] = { 0, 1, 5, 15, 30, 60, };
-const int	GRAPH_DATALINES[MAX_INTERVALS] = { 0, 800, 3200, 12000, 24000, 48000, };
+#define	MAX_INTERVALS	10
+const int	GRAPH_INTERVAL[MAX_INTERVALS] = { 0, 1, 5, 15, 30, 60, 120, 240, 480, 960 };
+const int	GRAPH_DATALINES[MAX_INTERVALS] = { 0, 800, 3200, 12000, 24000, 48000, 96000, 192000, 384000, 768000 };
 const char	MONTH[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
 
 
@@ -498,6 +498,8 @@
 		    break;
 		}
 	    }
+	    if (graphstep > MAX_INTERVALS)
+		graphstep = MAX_INTERVALS;
 	    syslog(LOG_NOTICE, "ARCHIVE LOG %s: lines=%d, interval=%d, graphstep=%d", param, lines, GRAPH_INTERVAL[graphstep], graphstep);
 
 	    while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) {

mercurial