[mythtv-users] Mythfrontend idle cpu consumption help

Jim Stichnoth stichnot at gmail.com
Sat Nov 7 03:39:21 UTC 2009

On Fri, Nov 6, 2009 at 1:14 PM, Johnny <jarpublic at gmail.com> wrote:
>> Ok, I don't use all the plugins like weather games and a few others so I had
>> removed them from mythbuntu control center.  However, I gave it a shot to go
>> all all of them back in, and my cpu usage is normal even for scaled
>> resolutions.
>> What do you think, does this constitute enough evidence/info to enter a
>> bug?  It seems to me like it is a mythfrontend issue with themes and
>> possibly some dependency on some plugins.
> Are you sure you are waiting long enough after restarting the frontend
> to see the steady state CPU usage. I get the same thing regardless of
> what I have the GUI resolution set to. I am on SD CRT and I tried
> 640x480 and the theme base resolution of 1280x720. I also have almost
> all of those plugins installed. If I restart the frontend the CPU
> usage goes down and then after a minute or two it will come back up to
> 15% and sit there like that. So if I don't wait long enough then it
> appears that the CPU usage is down around 0% to 1%, but if I wait I
> see the steady state of 15%.

I tried to take a deeper look at this.  I used the Intel VTune
performance analyzer to sample mythfrontend while it was sitting idle
on the main menu page.  The top routine in mythfrontend in terms of
CPU usage was MythUIType::Pulse().  Its function is to call
HandleMovementPulse() and HandleAlphaPulse() on the current object,
and then call Pulse() on all its children.  Pulse() is called at the
top level by MythMainWindow::animate().  The MythMainWindow
constructor creates a timer to call animate() 70 times per second.

So, even if the frontend is on a menu page that "does nothing", it is
still 70 times per second looking at all buttons, backgrounds, text
areas, etc., to see if anything needs to "pulse".  And the more
heavyweight the theme, the more widgets it has to look at.

If anyone wants to experiment, try reducing the refresh rate of 70
times per second to something like 10 times per second.  Look for the
2 statements "d->drawTimer->start(1000 / 70);" in mythmainwindow.cpp
and change the 70 to 10, then see how much it reduces the CPU usage
when idle.


More information about the mythtv-users mailing list