iMore tolerant alerting

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@38756 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2015-07-06 18:44:14 +00:00
parent 21f3503ad6
commit 05f16eec89
3 changed files with 25 additions and 14 deletions

View file

@ -1,3 +1,13 @@
2015-07-06 Richard Frith-Macdonald <rfm@gnu.org>
* EcProcess.h:
* EcProcess.m:
Various tweaks to leak alert generation. Change default initial
thresholds and change increments after an alert to be based upon
the *peak* usage at the point when the alert was generated, rather
than on the previous threshodld. This reduces the number of alerts
in a process whose memory usage grows rapidly on startup.
2015-07-03 Richard Frith-Macdonald <rfm@gnu.org>
* EcProcess.h:

View file

@ -103,12 +103,13 @@
</desc>
<term>EcMemoryIncrement</term>
<desc>
This integer value controls the (KBytes) increment in process
memory usage after which an alert is generated.<br />
This integer value controls the (KBytes) increment (from
current peak value) in process memory usage after which
an alert is generated.<br />
If this is not set (or is set to a value less than ten or
greater than a million) then a value of five thousand is used
unless EcMemory is set (in which case twenty is used).<br />
Setting a higher value make memory leak detection less
Setting a higher value makes memory leak detection less
sensitive (but reduces unnecessary alerts).<br />
If used in conjunction with EcMemoryPercentage, the greater
of the two allowed memory values is used.<br />
@ -127,12 +128,12 @@
<term>EcMemoryPercentage</term>
<desc>
This integer value controls the increase in the alerting
threshold after which a memory usage alert is generated.<br />
The increase is calcuilated as a percentage of the current
memory usage value when an alert is generated.<br />
threshold after which a memory usage alert is generated.<br />
The increase is calculated as a percentage of the current
peak memory usage value when an alert is generated.<br />
If this is not set (or is set to a value less than one or
greater than a thousand) then a value of ten is used unless
EcMemory is set (in which one is used).<br />
EcMemory is set (in which case a value of one is used).<br />
Setting a higher value make memory leak detection less
sensitive (but reduces unnecessary alerts).<br />
If used in conjunction with EcMemoryIncrement, the greater

View file

@ -2391,11 +2391,6 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
NSInteger iMax = 0;
NSInteger pMax = 0;
/* Alert because the average has risen above the allowed size.
*/
[self cmdError: @"Average memory usage grown to %"PRIu64"KB",
memAvge / 1024];
/* We increase the threshold for the next alert by a percentage
* of the existing usage or by a fixed increment, whichever is
* the larger.
@ -2429,17 +2424,22 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
}
if (inc > 0)
{
iMax = memWarn + (inc * 1024);
iMax = memPeak + (inc * 1024);
}
if (pct > 0)
{
pMax = (memWarn * (100 + pct)) / 100;
pMax = (memPeak * (100 + pct)) / 100;
}
memWarn = (iMax > pMax) ? iMax : pMax;
if (memWarn % 1024)
{
memWarn = (memWarn / 1024 + 1) * 1024;
}
/* Alert because the average has risen above the allowed size.
*/
[self cmdError: @"Average memory usage grown to %"PRIu64"KB",
memAvge / 1024];
}
if (YES == [cmdDefs boolForKey: @"Memory"])