[mythtv-users] Mythfrontend idle cpu consumption help

Jim Stichnoth stichnot at gmail.com
Sun Jan 24 14:40:07 UTC 2010


On Fri, Jan 22, 2010 at 8:39 PM, Michael T. Dean
<mtdean at thirdcontact.com> wrote:
> 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.

My patch in ticket #7953 reduces my ION system's CPU usage to under 1%
on the Main Menu screen and under 2% on the Watch Recordings screen
(as long as there are no animations going on).

Jim


More information about the mythtv-users mailing list