[mythtv-users] CPU load when watching TV

Rod Smith mythtv at rodsbooks.com
Sun Dec 13 00:56:25 UTC 2009


On Saturday 12 December 2009 06:54:09 pm lee wrote:
> On Sat, Dec 12, 2009 at 04:23:52PM -0700, Brian Wood wrote:
> > > >
> > > > More details on your system, and the actual numbers, would help. So
>
> Debian testing, amd64, Phenom 965, GeForce GT 240
>
> Xosview shows from 20% to 40% on the four processor cores when
> watching live tv with mythtvfrontend. When not watching (and not much
> else is going on), it shows between 0% and 12%.

I've never used xosview before, but I just gave it a try. On my dual-core AMD 
X2 5400+ with ATI HD3200 video, playing SD content, I got loads of 10% on one 
CPU and 10-40% on the other. Playing HD content, loads jumped around between 
10% and 60% on both CPUs. Since top averages over time and measures by 
process, it's a bit easier to read what's chewing up CPU time by using top 
(although as Brian says, top also hides spikes). On this same system, I get 
10% CPU load for X for both SD and HD content, and mythfrontend clocks in at 
20-30% for SD and 50-60% for HD content. I believe the top figures are 
per-CPU, so on a dual-core system, you could have up to 200% CPU consumption, 
and the 60-70% total I'm seeing from top really reflects only 30-35% of my 
system's potential. (I used my main desktop system, not my main MythTV 
frontend system, to get these figures; my desktop system just happens to be 
handy as I write this message. I haven't spent much time optimizing this 
system for MythTV use.)

Given this comparison, if you're watching HD content, your CPU load is 
probably reasonable -- I'm assuming the load is jumping around between your 
four cores, so you're not really running all four cores at 40% 
simultaneously. (OTOH, I might be underestimating the difference between your 
Phenom 965 and my X2 5400+.) Decoding HD video content is very CPU-intensive. 
TVs, set-top boxes, and the like get by with weaker CPUs because they've got 
specialized chips to do the MPEG decoding. If you're getting that sort of 
load with SD content, then it probably does reflect some poor configuration, 
but you should figure out if that's in the MythTV side, in X, or in something 
else.

> That way, it's hard to tell what load mythtvfrontend actually
> causes. But kaffeine, for example, doesn't cause a load like
> mythtvfrontend does.

It's possible that MythTV is doing more than Kaffeine. For instance, MythTV 
provides some rather CPU-intensive deinterlacing options, and some versions 
provide 5.1 audio upmixing, which on my regular frontend (with a dual-core 
Celeron E3300) chews up an extra 10-20% CPU time. You can find these options 
in the various setup screens. The deinterlacing options are in Setup->TV 
Settings->Playback. The third screen lets you edit playback profiles for 
various resolutions. You can set what decoder is used, what deinterlacer is 
used, and so on. I don't recall offhand where the 5.1 audio upmix options are 
located, but it's in another of the setup screens. My understanding is it's 
very new; I don't think it's even in the standard 0.22 release, but only in 
some updated versions. (I'm using the Avenard packages, available from 
http://www.avenard.org/media/Ubuntu_Repository/Ubuntu_Repository.html.)

> > > > VDPAU will drop your CPU load, assuming the load is from decoding the
> > > > video and not something else.
>
> How can I tell if VDPAU is used?

That's one of the decoding options in the playback profiles. It's only usable 
on some recent nVidia video cards with nVidia's proprietary drivers. See 
http://www.mythtv.org/wiki/VDPAU for details. Note that using VDPAU just 
shifts much of the decoding burden from the CPU to the GPU. Since you say 
your concern is with power consumption, I'm not sure this would really be an 
improvement. You could always measure it with an appropriate meter, of 
course.

> > > Another observation: In my experience, misconfiguring X can result in a
> > >  heavy CPU load from X, vs. from the MythTV frontend.
>
> Well, I haven't had this problem yet.

Earlier you said you couldn't identify where your CPU load was coming from. 
Note that I'm referring to a heavy load from X when playing video, not just 
as a baseline. The X load DOES go up when MythTV (or anything else) plays 
video, and if X is misconfigured, it'll go up A LOT more. On my previous 
frontend (using a single-core Celeron D 3.06GHz), my original configuration 
had mythfrontend chewing up 50% of CPU and X consuming another 50% when 
playing back HD content on an SD TV. Brief spikes would cause stuttering and 
pauses on a regular basis. When I fixed my X configuration, its load dropped 
to about 10-20%, IIRC, and the system could play back HD content fine -- 
although that became dicey when the system was simultaneously transcoding, 
commflagging, or doing anything else. Hence my recent upgrade to a dual-core 
E3300 CPU.

> But mythtvfrontend as well as 
> mythtv-setup make the mouse pointer invisible once it enters the
> window. Is there a way to change that?

I seem to recall there's a setup option that controls this -- or at least that 
should. (One of my minor problems with 0.22 is that the mouse pointer tends 
to reappear if I switch to a text-mode console and then switch back to X.) I 
don't recall exactly where this option is, though.

> The harder the CPU has to work, the more power it consumes. Anyway,
> getting 20--40% load just from watching TV is quite a lot, considering
> the hardware I have. In a way it doesn't really matter since it's
> running smoothly, but it eventually blocks resources that could be
> used for something else instead. And I haven't tried yet to watch
> while other things put some load on the CPU, maybe it won't so smooth
> anymore ...

That's certainly possible. Is this a combined desktop/frontend? You could try 
putting a typical high desktop load on the system and see how it then handles 
playback. If the system is a dedicated Myth box, then you might need to be 
concerned with transcoding, commflagging, and occasionally database updates, 
but not much else. Those processes, of course, can cause problems, but you 
could trigger them manually and see what happens. In my experience, database 
updates are the biggest problem, because they tend to run without being 
niced.

-- 
Rod Smith


More information about the mythtv-users mailing list