Author: rfm
Date: Tue Jul  7 17:11:34 2015
New Revision: 38761

URL: http://svn.gna.org/viewcvs/gnustep?rev=38761&view=rev
Log:
tweak default memory increment for fine grained alerting

Modified:
    libs/ec/trunk/EcProcess.h
    libs/ec/trunk/EcProcess.m

Modified: libs/ec/trunk/EcProcess.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.h?rev=38761&r1=38760&r2=38761&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.h   (original)
+++ libs/ec/trunk/EcProcess.h   Tue Jul  7 17:11:34 2015
@@ -100,7 +100,7 @@
               is specified) then memory is monitored for ten minutes and
               the threshold is set at the peak during that period plus a
               margin to allow further memory growth before warning.<br />
-              The margin is at least 20KB on a test system, 5000KB on
+              The margin is at least 50KB on a test system, 5000KB on
               a non-test system.
            </desc>
            <term>EcMemoryIncrement</term>

Modified: libs/ec/trunk/EcProcess.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.m?rev=38761&r1=38760&r2=38761&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.m   (original)
+++ libs/ec/trunk/EcProcess.m   Tue Jul  7 17:11:34 2015
@@ -519,13 +519,16 @@
 
 static uint64_t memMaximum = 0;
 static uint64_t        memAllowed = 0;
-static uint64_t        memAvge = 0;
-static uint64_t        memLast = 0;
-static uint64_t        memPeak = 0;
-static uint64_t        memWarn = 0;
-static uint64_t        memSlot = 0;
-static uint64_t        memRoll[10];
+static uint64_t        memAvge = 0;    // current period average
+static uint64_t        memStrt = 0;    // usage at first check
+static uint64_t        memLast = 0;    // usage at last check
+static uint64_t        memPrev = 0;    // usage at previous warning
+static uint64_t        memPeak = 0;    // peak usage
+static uint64_t        memWarn = 0;    // next warning point
+static uint64_t        memSlot = 0;    // minute counter
+static uint64_t        memRoll[10];    // last N values
 #define        MEMCOUNT (sizeof(memRoll)/sizeof(*memRoll))
+static NSDate   *memTime = nil; // Time of last alert
 
 #ifndef __MINGW__
 static int              reservedPipe[2] = { 0, 0 };
@@ -2308,6 +2311,8 @@
         {
           memRoll[i] = memLast;
         }
+      memPrev = memStrt = memLast;
+      ASSIGN(memTime, [NSDate date]);
     }
   memRoll[memSlot % MEMCOUNT] = memLast;
   memSlot++;
@@ -2373,17 +2378,16 @@
           if (YES == memDebug)
             {
               /* We want detailed memory information, so we set the next
-               * alerting threshold from 20 to 40 KB above the current
-               * peak usage.
+               * alerting threshold 50 KB above the current peak usage.
                */
-              inc = 20;
+              inc = 50;
               pct = 0;
             }
           else
             {
               /* We do not want detailed memory information,
                * so we set the next alerting threshold from
-               * 5 to 10 MB above the current peak usage,
+               * 5000 KB above the current peak usage,
                * ensuring that only serious increases
                * in usage will generate an alert.
                */
@@ -2410,8 +2414,16 @@
        */
       if (memSlot >= MEMCOUNT)
         {
-          [self cmdError: @"Average memory usage grown to %"PRIu64"KB",
-            memAvge/1024];
+          uint64_t      prev;
+          NSDate        *when;
+
+          prev = memPrev;
+          when = AUTORELEASE(memTime);
+          memPrev = memAvge;
+          memTime = [NSDate new];
+          [self cmdError: @"Average memory usage grown from %"
+            PRIu64"KB to %"PRIu64"KB since %@",
+            prev/1024, memAvge/1024, when];
         }
     }
 
@@ -3406,8 +3418,10 @@
         @" %"PRIu64"KB (peak)\n",
         memLast/1024, memPeak/1024];
       [self cmdPrintf: @"              %"PRIu64"KB (average),"
-        @" %"PRIu64"KB (exempt)\n",
-        memAvge/1024, [self ecNotLeaked]/1024];
+        @" %"PRIu64"KB (start)\n",
+        memAvge/1024, memStrt/1024];
+      [self cmdPrintf: @"              %"PRIu64"KB (exempt)\n",
+        [self ecNotLeaked]/1024];
       [self cmdPrintf:
         @"Memory error reporting after average usage: %"PRIu64"KB\n",
         memWarn/1024];


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to