[mythtv-users] Mythfrontend idle cpu consumption help

Michael T. Dean mtdean at thirdcontact.com
Sat Jan 23 04:39:02 UTC 2010


On 01/22/2010 06:52 PM, Jim Stichnoth wrote:
> I think the problem here is the QTimer class.  It apparently tries
> very hard to make the timer fire off at the precise interval with
> perhaps near-microsecond accuracy.  It would appear that it does an OS
> sleep for most of the interval and then does a CPU-consuming busy-wait
> for the last part.  That last part appears to be almost 1ms
> busy-waiting for the 7% crowd and almost 2ms for the 15% crowd.
> Whether it's 1ms or 2ms probably depends on the version of the Qt
> library and/or the kernel config options.
>
> We probably don't need this level of timing precision in MythUI.  One
> possibility is to replace the use of QTimer for invoking animate()
> with some less precise timer that doesn't busy-wait.  Another
> possibility is to somehow tie this in to the video sync.
>   

Yes.  The timer wakes too early and it then uses a busy loop to wait. 
This same thing was the reason some Qt apps had to be modified with
different timer values to "get everything in sync" when ported from Qt3
to Qt4.

Something like:

http://websvn.kde.org/trunk/KDE/kdebase/workspace/kwin/composite.cpp?r1=847403&r2=850941&pathrev=850941

Mike


More information about the mythtv-users mailing list