[mythtv-users] Frontend hogs the CPU

Robert Johnston anaerin at gmail.com
Sat Jul 14 06:58:52 UTC 2007


On 7/13/07, Jim Carter <jimc at math.ucla.edu> wrote:
> I've installed MythTV for the first time and am having major pains.
>
> Upon non-obvious events, either during watching live TV or when
> the menu is shown, the frontend will get into a high CPU state in which,
> according to strace, it does
>     select((17, [14 16], NULL, NULL, {0, 10000}) = 0 (Timeout)
> over and over; I never saw the FD's being ready, always it timed out.
> (Come to think...  timed out selects would make the process always be in
> run state but would have expended relatively little CPU, so likely
> another of the three reported threads was hogging the CPU.)
>
> The result of the latter behavior was that the user interface was
> extremely sluggish: a full minute for an arrow key to have a visible
> effect, for example.  But it wasn't actually frozen.
>
> This was with the G.A.N.T. theme.  After I switched to Blue, which may
> or may not have been relevant, and after two hours of live TV
> (surprisingly, with few or no dropped frames despite 100% CPU usage and
> a load average of 4.9), I returned to the menu and spotted a behavior:
> CPU use is 0, press arrow key once, CPU goes to 100%, wait, effect is
> seen on screen, CPU drops to 0.
>
> The UI is configured to use OpenGL.  Normal GL apps such as glxgears and
> MESA demos run normally.  The MythTV UI seemed faster when OpenGL was
> turned on, than when it was off.
>
> Does anyone have any idea what's going on, and what to do to make it
> stop hogging the CPU?
>
> My configuration:
>     Dell Dimension 4100 -- Intel Pentium III "Coppermine" 1.0 GHz
>     256 Mb RAM.  40 Gb disc.
>     Operating system: OpenSuSE 10.2, kernel 2.6.18.8
>     Graphics: nVidia GeForce2 MX 400
>     MythTV version: 0.20
>     Capture card: pcHDTV HD-5500
>     Leading drivers: cx88_blackbird cx2341x cx88_dvb etc.
>
> Yes, I know the system is a bit underpowered.  MythTV is currently in
> a competition with Windows Vista Media Center Edition, which we loathe,
> and if $spouse judges that MythTV isn't as awful as MCE then it will
> get to run on an almost-new Dell Dimension E510 dual-core at 1.8 GHz
> with a Seagate 160 Gb disc.  But MythTV has to actually perform first.

This is a combination of things. And it is probably related to your
other thread, so here goes.

Firstly, the pcHDTV is a 2-part card. The first part (The NTSC part)
is a regular non-encoding BT8x8 card, which is accessed using standard
V4L routines. The second part (The ATSC/DVB/QAM/HD part) is a
stream-copying DVB card. However, as you have no ATSC/DVB/QAM signal
going into the card (You stated before you don't have digital cable,
just basic), what is happening is that as Myth(Backend) is "Recording"
from the card, it's having to use CPU resources to encode the raw
video frames into some other format. You don't say which you're using,
so it could be NUV or MP4/XVID (Or MP2, IIRC). Either way, it's a very
processor intensive task to encode video in realtime. Add to that the
strain of then re-decoding the video (In the frontend), and handle the
FS traffic necessary to handle the image swapping for the menu (As
you've only got 256MB RAM, you're really pushing your luck with a
graphics/CPU intensive program suite like Myth), it's hardly
surprising you're having problems.

So, what can you do to resolve the situation?

First, make sure you're capturing in NUV/RTJpeg, as it's the least
resource intensive.
Next, drop your capture res to 480x480 (Or lower) so you don't have to
schlump as many bytes around.
Third, add another 256MB RAM to that box.
Finally, make sure you have DMA enabled on your hard-drives (HDParm is
your friend).

Hopefully this will help some.
-- 
Robert "Anaerin" Johnston


More information about the mythtv-users mailing list