Add warning logs

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28620 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-09-07 09:53:27 +00:00
parent 6b1b12123a
commit 1cf4c0937c
3 changed files with 32 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2009-09-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSRunLoop.m:
* Source/GSRunLoopCtxt.h:
Add some logging to help debug problems where code is adding too
many events into a run loop.
2009-09-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSLock.m: Fix the ([-tryLock]) and [(-lockBeforeDate:])

View file

@ -62,8 +62,11 @@ typedef struct{
void *extra; /** Copy of the RunLoop ivar. */
NSString *mode; /** The mode for this context. */
GSIArray performers; /** The actions to perform regularly. */
unsigned maxPerformers;
GSIArray timers; /** The timers set for the runloop mode */
unsigned maxTimers;
GSIArray watchers; /** The inputs set for the runloop mode */
unsigned maxWatchers;
NSTimer *housekeeper; /** Housekeeping timer for loop. */
@private
#if defined(__MINGW32__)

View file

@ -405,6 +405,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
{
GSRunLoopCtxt *context;
GSIArray watchers;
unsigned i;
context = NSMapGet(_contextMap, mode);
if (context == nil)
@ -415,6 +416,13 @@ static inline BOOL timerInvalidated(NSTimer *t)
}
watchers = context->watchers;
GSIArrayAddItem(watchers, (GSIArrayItem)((id)item));
i = GSIArrayCount(watchers);
if (i % 1000 == 0 && i > context->maxWatchers)
{
context->maxWatchers = i;
NSLog(@"WARNING ... there are %u watchers scheduled in mode %@ of %@",
i, mode, self);
}
}
- (void) _checkPerformers: (GSRunLoopCtxt*)context
@ -840,6 +848,13 @@ static inline BOOL timerInvalidated(NSTimer *t)
* all each time -limitDateForMode: is called.
*/
GSIArrayAddItem(timers, (GSIArrayItem)((id)timer));
i = GSIArrayCount(timers);
if (i % 1000 == 0 && i > context->maxTimers)
{
context->maxTimers = i;
NSLog(@"WARNING ... there are %u timers scheduled in mode %@ of %@",
i, mode, self);
}
}
@ -1484,6 +1499,13 @@ static inline BOOL timerInvalidated(NSTimer *t)
{
GSIArrayInsertItem(performers, (GSIArrayItem)((id)item), i);
}
i = GSIArrayCount(performers);
if (i % 1000 == 0 && i > context->maxPerformers)
{
context->maxPerformers = i;
NSLog(@"WARNING ... there are %u performers scheduled"
@" in mode %@ of %@", i, mode, self);
}
}
RELEASE(item);
}