[mythtv-users] Mythfrontend idle cpu consumption help

Jim Stichnoth stichnot at gmail.com
Mon Jan 25 22:28:42 UTC 2010


On Fri, Jan 22, 2010 at 2:11 PM, jansenj <jansenj+myth at gmail.com> wrote:
> On Thu, Oct 29, 2009 at 3:04 PM, jansenj <jansenj+myth at gmail.com> wrote:
>>
>> I just noticed that when I do a "top" that mythfrontend.real is consuming
>> almost 15% CPU when it is running at 1Ghz.  I'm using mythbuntu theme with
>> Qt on mythbuntu's 0.22-fixes packages.  Any ideas what could have changed?
>> Or is it something I could have changed?
>
> I thought I'd reply to my original post.
>
> The behavior here is without a doubt attributed to mythui pulse.
>
> It looks like animate is called at 70Hz, and as it was said in this thread,
> this can be dropped much lower if you don't have animations, but it takes
> modifying source and rebuilding.
>
> I'm astounded that the majority of the people reporting this behavior report
> similar cpu usage levels, no mater what the clock speed of the cpu.  In fact
> I can have mine clocked at 1Ghz or 2Ghz, and both result in a 14%
> utilization, so there seems to be an odd timing or wait component that
> doesn't give up context, but I couldn't find one.  But if we do the math,
> every time animate runs, it consumes the cpu for a full 2ms.
>
> It looks like Animate calls a bunch of pulses from all sorts of object
> types: clocks, images, text...etc.  It looks like to me, that all pulses
> eventually end up calling mythuitype::pulse which sets up the screen to
> redraw if it detected any motion or alpha blending changes.  Then it loops
> through and does a pulse on all the given children for that single item.
>
> Something that confused me: I tried commenting out all the pulse bodies that
> call mythuitype::pulse, and I still could get into a mode where 14%
> utilization was seen.  But if I comment out the body of mythuitype::pulse
> the cpu usage drops way down, but myth doesn't work very well if you do
> that.  After all, it looks like for every iteration of animate
> mythuitype::pulse gets called 39 times in my setup.  That means, normally,
> it is doing an alpha pulse and motion pulse 2700 times per second each.  But
> I wouldn't think that would add up to 140ms of time.

Would it be possible for you to try out the patch in ticket #7953?  I
know that QTimer should be responsible for up to 1ms of spin-waiting
per signal, but you (and everyone else in the 14-15% camp) are
spending 2ms of CPU time per signal.  I'd like to know if your idle
frontend CPU usage drops all the way to 1-2%, or only goes down to
7-9%.

(In case you haven't applied patches before, save
http://svn.mythtv.org/trac/raw-attachment/ticket/7953/7953-v1.patch to
a file, then change into the top-level "mythtv" source directory and
run "patch -p0 < 7953-v1.patch".)

Jim


More information about the mythtv-users mailing list