mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-22 19:31:53 +00:00
tweak default memory increment for fine grained alerting
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@38761 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
47d3e23818
commit
6cc3d6accf
2 changed files with 29 additions and 15 deletions
|
@ -100,7 +100,7 @@
|
||||||
is specified) then memory is monitored for ten minutes and
|
is specified) then memory is monitored for ten minutes and
|
||||||
the threshold is set at the peak during that period plus a
|
the threshold is set at the peak during that period plus a
|
||||||
margin to allow further memory growth before warning.<br />
|
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.
|
a non-test system.
|
||||||
</desc>
|
</desc>
|
||||||
<term>EcMemoryIncrement</term>
|
<term>EcMemoryIncrement</term>
|
||||||
|
|
42
EcProcess.m
42
EcProcess.m
|
@ -519,13 +519,16 @@ ecHostName()
|
||||||
|
|
||||||
static uint64_t memMaximum = 0;
|
static uint64_t memMaximum = 0;
|
||||||
static uint64_t memAllowed = 0;
|
static uint64_t memAllowed = 0;
|
||||||
static uint64_t memAvge = 0;
|
static uint64_t memAvge = 0; // current period average
|
||||||
static uint64_t memLast = 0;
|
static uint64_t memStrt = 0; // usage at first check
|
||||||
static uint64_t memPeak = 0;
|
static uint64_t memLast = 0; // usage at last check
|
||||||
static uint64_t memWarn = 0;
|
static uint64_t memPrev = 0; // usage at previous warning
|
||||||
static uint64_t memSlot = 0;
|
static uint64_t memPeak = 0; // peak usage
|
||||||
static uint64_t memRoll[10];
|
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))
|
#define MEMCOUNT (sizeof(memRoll)/sizeof(*memRoll))
|
||||||
|
static NSDate *memTime = nil; // Time of last alert
|
||||||
|
|
||||||
#ifndef __MINGW__
|
#ifndef __MINGW__
|
||||||
static int reservedPipe[2] = { 0, 0 };
|
static int reservedPipe[2] = { 0, 0 };
|
||||||
|
@ -2308,6 +2311,8 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
{
|
{
|
||||||
memRoll[i] = memLast;
|
memRoll[i] = memLast;
|
||||||
}
|
}
|
||||||
|
memPrev = memStrt = memLast;
|
||||||
|
ASSIGN(memTime, [NSDate date]);
|
||||||
}
|
}
|
||||||
memRoll[memSlot % MEMCOUNT] = memLast;
|
memRoll[memSlot % MEMCOUNT] = memLast;
|
||||||
memSlot++;
|
memSlot++;
|
||||||
|
@ -2373,17 +2378,16 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
if (YES == memDebug)
|
if (YES == memDebug)
|
||||||
{
|
{
|
||||||
/* We want detailed memory information, so we set the next
|
/* We want detailed memory information, so we set the next
|
||||||
* alerting threshold from 20 to 40 KB above the current
|
* alerting threshold 50 KB above the current peak usage.
|
||||||
* peak usage.
|
|
||||||
*/
|
*/
|
||||||
inc = 20;
|
inc = 50;
|
||||||
pct = 0;
|
pct = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We do not want detailed memory information,
|
/* We do not want detailed memory information,
|
||||||
* so we set the next alerting threshold from
|
* 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
|
* ensuring that only serious increases
|
||||||
* in usage will generate an alert.
|
* in usage will generate an alert.
|
||||||
*/
|
*/
|
||||||
|
@ -2410,8 +2414,16 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
*/
|
*/
|
||||||
if (memSlot >= MEMCOUNT)
|
if (memSlot >= MEMCOUNT)
|
||||||
{
|
{
|
||||||
[self cmdError: @"Average memory usage grown to %"PRIu64"KB",
|
uint64_t prev;
|
||||||
memAvge/1024];
|
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 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
@" %"PRIu64"KB (peak)\n",
|
@" %"PRIu64"KB (peak)\n",
|
||||||
memLast/1024, memPeak/1024];
|
memLast/1024, memPeak/1024];
|
||||||
[self cmdPrintf: @" %"PRIu64"KB (average),"
|
[self cmdPrintf: @" %"PRIu64"KB (average),"
|
||||||
@" %"PRIu64"KB (exempt)\n",
|
@" %"PRIu64"KB (start)\n",
|
||||||
memAvge/1024, [self ecNotLeaked]/1024];
|
memAvge/1024, memStrt/1024];
|
||||||
|
[self cmdPrintf: @" %"PRIu64"KB (exempt)\n",
|
||||||
|
[self ecNotLeaked]/1024];
|
||||||
[self cmdPrintf:
|
[self cmdPrintf:
|
||||||
@"Memory error reporting after average usage: %"PRIu64"KB\n",
|
@"Memory error reporting after average usage: %"PRIu64"KB\n",
|
||||||
memWarn/1024];
|
memWarn/1024];
|
||||||
|
|
Loading…
Reference in a new issue