[mythtv-users] Mythfrontend idle cpu consumption help

Jim Stichnoth stichnot at gmail.com
Tue Nov 17 20:25:26 UTC 2009

On Tue, Nov 17, 2009 at 10:07 AM, jansenj <jansenj+myth at gmail.com> wrote:
>> Again, that's completely normal for the /current/ implementation of the UI
>> with some themes.  There /is/ a ticket (
>> http://svn.mythtv.org/trac/ticket/7525 ) already filed that shows "it [will]
>> be investigated" (or, more to the point--the design will be changed to make
>> it more efficient, as this is an already-understood feature of the current
>> design).
> I'm sorry, I must have missed the part where the investigation is complete.
> I wasn't aware there was enough evidence to blame the behavior on the
> intended operation of alpha pulse.
>> That doesn't mean it's a bug.
> Since this is NEW behavior for most of us who have the issue, something
> changed that is causing the behavior.  I have never seen it before 0.22 with
> ubuntu 9.10, the behavior didn't change on its own.  It seems a little
> premature to say definitively that its NOT a bug.  I'm using the same exact
> hardware I was under 0.21-fixes.  I kept the same settings and the same
> theme as I had in 0.21.
>> But, basically, we're all stuck with it until someone implements the new,
>> more-optimized design being planned in #7525.
> What happens if the changes for 7525 don't help the behavior reported by
> several individuals, what would your response then be?  What else could be
> the culprit?  If a developer says this is the ONLY possible way to explain
> the extra CPU usage...OK.
>> And, G.A.N.T made /much/ less use of alpha pulse than do some of the new
>> themes.  Note that on the same setup, using a theme without alpha pulse, I
>> see 0-1% CPU usage at idle.
> If you sure the problem lies with alpha pulse, and that some themes don't
> use alpha pulse, I'd be happy to know which ones because EVERY theme I've
> tried under 0.22 produce the some high idle cpu usage.
>> Disable alpha pulse in the theme you're using and I'll bet your CPU usage
>> drops noticeably...  (Or, install 0.21-fixes and load up G.A.N.T or add some
>> alpha pulse to some other themes and I'll bet you'll see the CPU usage isn't
>> low for the previous version, either.)
> If there is a setting to control this that I am unaware of, please
> elaborate.

I agree with Mike that there are at least two separate issues going on here.

1. Some low-ish but non-trivial CPU utilization, like 5-15%, when
sitting "idle" on a menu screen.  This is most likely due to the
so-called "alpha pulse" issue.  There seems to be a lot of confusion
over this, so let me explain in more detail.  Animation in MythUI is
currently done by having the code periodically check every display
element to see if it needs to be updated.  Alpha pulse is one example
of something that needs periodic (frequent) updates.  The UI Clock is
another example, though it needs very infrequent updates.  Animated
images are another example.  There are several performance problems
with the current implementation, as documented in #7525.  First, the
pulse check is always done 70 times per second regardless of whether
any element needs to be updated that frequently.  Second, all elements
are considered for the pulse check even if you can tell that entire
sections of the layout never need pulsing/animation.  Third, repaints
are always requested even there is no update.  I believe that if and
when #7525 is implemented, this 5-15% CPU utilization will go down to
close to 0.

1a. There's the obscure issue I found involving buggy NFS credential
caching in the 2.6.27 kernel, along with the whether the TZ
environment variable is set, which affected me and probably virtually
no one else, so I won't go into it.

2. Something that kicks CPU utilization up to 100%, even on a hefty
modern CPU.  This needs more investigation and characterization and
may not be affected by #7525.

At this point I would like to put in a plug for the Intel VTune
performance analyzer.  This is a commercial product, but it is
supposedly free for non-commercial use, for which MythTV development
should qualify.  To use VTune in its basic form on an application, you
don't need to recompile the application, and you don't even need to
restart the application.  The way it works is that it configures the
hardware performance counters such that every Nth time one of these
performance counter events occurs, it traps out to a VTune routine
which logs the instruction address.  Two very useful performance
counters are clockticks and retired instructions.  VTune samples the
entire system, including all running processes and threads, so you can
drill down into the desired process/thread/module/function where the
sampled events are happening.  VTune can start an application for you
and wait for it to finish, or it can just monitor the system for a
period of time without starting an application.

If there is someone who is experiencing the 100% CPU utilization
problem and is interested in helping get to the bottom of it, I would
encourage trying out VTune.  Again, you don't have to recompile (or
even compile in the first place) the myth binaries.  After a quick
sampling run, it should be immediately apparent whether the CPU time
is being spent in mythfrontend, the Qt libraries, the libc libraries,
the Linux kernel, a kernel module, or elsewhere.  If the necessary
symbols are missing from the binaries, it could be hard to identify
the actual functions or modules where the time is being spent, but
identifying the problematic application or library would be a big step


More information about the mythtv-users mailing list