Re: POE & Tk excessive CPU usage?
Slaven Rezic <[email protected]> 11 Jul 2007 00:24:28 +0200
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
Craig Votava <[email protected]> writes: > Ala, Folks- > > The POE::Loop::Tk module is what the provided > example program ends up using (it's not obvious > when looking at the code). In POE, the rules are > that if you "use Tk" before you "use POE", then > POE will automagically provide you with Tk-ish > things like POE::Loop::Tk. > > The problem I'm seeing here is that it uses up > way too much CPU when it's doing nothing. I suspect > this has something to do with event loop sharing > between the Tk event loop and the POE event loop. > > The POE author (Rocco Caputo) has verified this > problem, but was unable to fix it by diddling for > an hour or so. He asked me to create a bug report, > and he'll get around to it when he has more time. > > I was hoping someone here, who knows the guts of > the Tk event loop might be able to shed some light > on the problem. > > Also, any validation and/or statistics on what > happens when the example program is run, would > be valuable input. When I am running your test script with Devel::Trace (perl -d:Trace test.pl), then I see a lot of calls in various POE modules and occassionaly a call to Tk's event peeking function: >> /usr/local/lib/perl5/site_perl/5.8.8/POE/Loop/TkCommon.pm:144: DoOneEvent(DONT_WAIT | ALL_EVENTS); This is a non-blocking call which immediately returns. The next line is: >> /usr/local/lib/perl5/site_perl/5.8.8/POE/Loop/TkCommon.pm:145: while ($_waiting_for_event) { $_waiting_for_event obviously false, because the next line DoOneEvent(ALL_EVENTS) is never executed. It seems to me that this call would be necessary for the system to wait for things (e.g. window events, file events). Otherwise these lines of code are called over and over again, causing the high CPU load. Note: I do not know nothing about POE and POE's interaction with Tk, I am just guessing. Regards, Slaven > > Thanks > > -Craig > > On Jun 11, 2007, at 10:38 AM, Ala Qumsieh wrote: > > > > > --- Craig Votava <[email protected]> wrote: > > > >> Folks- > >> > >> I was wondering if anybody in ptk-land could > >> help out with this problem. I've posted it > >> to the POE mailing list, and got corroboration, > >> but nobody knows what the problem is or how > >> to fix it. > > > > Never used POE, but browsing CPAN, I see there is a > > POE::Loop::Tk module. Maybe that would help somehow? > > --++**==--++**==--++**==--++**==--++**==--++**==--++**== > ptk mailing list > [email protected] > https://mailman.stanford.edu/mailman/listinfo/ptk > -- Slaven Rezic - slaven <at> rezic <dot> de tktimex - time recording tool http://sourceforge.net/projects/ptktools/ --++**==--++**==--++**==--++**==--++**==--++**==--++**== ptk mailing list [email protected] https://mailman.stanford.edu/mailman/listinfo/ptk