Re: LWM: Unusual cpu usage in window loaded from nib
On Jun 5, 2005, at 9:11 AM, Raffael Cavallaro wrote:
> On my machine, whenever this window loaded from a nib file is
> foreground, LWM's cpu usage goes up to about 7.5%. However, if any
> other LWM window is foreground - such as the Listener, or an Editor
> window - LWM's cpu usage is below 1%. Just for comparison, other
> Cocoa applications that load windows from nibs show a similarly low
> (~1%) cpu usage when the nib loaded window is foreground.
>
[snip]
> First, can others confirm this? Second, any thoughts on why this is
> happening?
I've seen this sort of behavior outside of LispWorks as well (but not
in every app). In general it seems to happen when the window in
question (window, sheet, or dialog) has a button which has 'return'
as the key equivalent. That splashy little pulsing "Compute" button
in this case is the CPU sucker. To verify I opened the NIB, removed
the key equivalent on the "Compute" button and re-ran the test. The
result was the typical ~1% CPU load and no more pulsing button.
I've never had much luck running GDB against lispworks but the
ThreadViewer.app has been useful. If you change the NIB back such
that the "Compute" button is bound to Return, launch ThreadViewer.app
and attach to LispWorks, re-run the example, and then bring the NIB
based window in and out of the foreground you can clearly see one
thread's activity changing. When I clicked on the thread in question
to look at its stack trace I noticed the following (area calculator
window was in the background):
semaphore_wait_signal_trap
pthread_cond_wait
-[NSConditionLock lockWhenCondition:]
-[NSUIHeartBeat _heartBeatThread:]
forkThreadForFunction
_pthread_body
....as to a particular solution or whether the CPU drain is even
avoidable I can't say...
Cheers,
-greg
_______________________________________________________
Greg Wuller greg@wuller.com
_______________________________________________________