[mythtv] If your CPU usage is too high (gcc flags)

Istvan Noszticzius noszti at selway.umt.edu
Tue Jun 3 12:08:31 EDT 2003


 All,

 Be careful when using different versions of gcc to compile mythtv (and
anything else that needs multimedia optimizations). I used to get very low
CPU usage on my backend+frontend MythTV system (similar to CPU usage #2
below), that I put together sometime in April. Then my HD crashed and I
reinstalled Gentoo in May, after which I was getting a much higher CPU
usage (like #1 below). After lots of experimenting (newer/older kernels,
different mythtv versions) I finally found the culprit: gcc! It seems the
gcc version (3.2.2) that came with the Gentoo distribution I installed
(starting from Stage1) in May does not automatically enable some of the
optimizations one would expect by using the "-march=athlon-xp" flag. So I
set some explicit CC flags, like "-m3dnow", etc, and got much better
results (see #2 below).

 While the overall CPU usage of MythTV is now much lower, I still get
occasional glitches during playback. I guess it's time to recompile the
system from scratch with the new flags, or at least xine/X and the like,
which might benefit from the extra CC flags.

 Note/1:
 May I suggest that mythtv settings.pro incorporate a script to figure out
what gcc flags to use? I was thinking in something along the lines of this
script: http://forums.gentoo.org/viewtopic.php?t=53602 
Note: the Gentoo mythtv 0.8 ebuild (mentioned in section 5.5.5 of the
MythTV documentation) does not seem use the CC flags set in
/etc/make.conf. (This is not a problem with the cvs ebuild recently posted
by Mike Javorski - Thanks!)

 Note/2:
 Also, some people have commented on this (or the users) list that top
shows multiple mythbackend/mythfrontend processes (due to top showing
multiple threads separately). I encountered this quite annoying (but
correct) behaviour in my newer (May) gentoo install (e.g. hard to add up
how much CPU mythtv is really using). As a solution I use top from the
procps-2.0.11 package (in addition to the 3.x series, which gentoo now
defaults to), which can show/hide(collapse) threads ("H" command) -- at
least as long as the process name is less then 16 characters.

 Cheers,

 István
 
 ----------------------------------------------------------------------

 HW Specs: CPU: AMD Athlon(TM) XP 2100+ 
           RAM: 256MB RAM, 
           VIDEO: nVidia GeForce4 MX440 / 64MB (with nVidia drivers)
           CAPTURE: Hauppauge WinTV 401
           L
 Kernel: 2.4.20-gentoo-r5
 Compiler: gcc 3.2.2

 MythTV Video settings: 
  320x240 mpeg-4, Bitrate: 1800, Max qual: 1 Min Qual: 15 Max qual diff: 3
  Scale bitrate: no, Enable HQ: no, Enable 4MV: no

 CPU idle time (higher is better) when in "Live TV" watching:
 Results:
 #1: gcc flags: ... -march=athlon-xp ... 
     idle time: approx. 50-60%
 #2: gcc flags: ... -m3dnow -mmmx -msse -mfpmath=sse -march=athlon-xp ...
                (note: I think -m3dnow implies -mmmx)
     idle time: approx. 85-90%




More information about the mythtv-dev mailing list