[mythtv-users] system profiling / cpu usage revisited

Brian Lalor blalor at bravo5.org
Thu Jun 19 17:06:01 EDT 2003


Ok, I've been doing some poking around with iostat and vmstat.  I changed my 
settings so that I'm now doing MPEG-4 encoding (exact params not important 
ATM).  My CPU's at ~100% most of the time that this recording is taking place. 
  iostat shows:

Time: 03:44:55 PM
avg-cpu:  %user   %nice    %sys   %idle
           99.10    0.00    0.70    0.20

Device:    rrqm/s wrqm/s   r/s   w/s  rsec/s  wsec/s    rkB/s    wkB/s \
	avgrq-sz avgqu-sz   await  svctm  %util
/dev/hda     0.00  46.00  0.00  8.80    0.00  438.40     0.00   219.20 \
	 49.82 4294697.37    0.80 113.64 100.00
/dev/hda5    0.00  45.00  0.00  6.40    0.00  411.20     0.00   205.60 \
	   64.25     0.06    0.94   0.47   0.30

Top shows mythbackend as the biggest CPU hog currently (of course):
   PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
29384 myth       9   0 41700  31M  3360 S    98.3  6.3  17:47   0 mythbackend

Let me just preface my remarks by saying that I don't really know the first 
thing about the workings of the kernel and system tuning, but I really want to 
get this sorted out, as I see many people having these issues.  It may be a 
bad choice of hard drive or motherboard, but I want to get to the bottom of it.

First, as iostat shows above (sorry for the line-wrapping), my CPU's maxxed 
out by user processes, not by the kernel.  Doesn't this mean that it is in 
fact mythbackend that is tying up the CPU by compressing the data, rather than 
(if %sys were very high) that the kernel was spending all of its time in I/O 
routines?

Second, the wkB/s column shows that I'm dumping about 205kB to the partition 
(/dev/hda5 is where my recordings go) a second (or around 1 meg every four 
seconds).  hdparm tells me my disk throughput is around 30 meg/s, so that 
should be plenty.  I don't know what to make of the write queue information.

Lastly, here's some vmstat info:
    procs                      memory      swap          io     system      cpu
r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id
1  0  0  17228   4408  41016 365680    0    0     0   198  164   296 100  0  0

Again we see my CPU maxxed, plenty of un-used memory, a bunch of blocks being 
written to the disk and a butt-load of context switches in the last two 
seconds (time since the last report).  Does that seem like a lot?  I dunno. 
Maybe someone else can do a similar analysis on a similar machine that can do 
the MPEG-4 encoding without breaking a sweat?  Here's a breakdown of my 
hardware again:
Asus A7V8X-X motherboard (via chipset)
AMD AthlonXP 1700+
512MB PC2700 DDR RAM
WinTV-dbx tuner card
120GB 7200RPM Hitachi IDE drive
linux kernel 2.4.21 compiled exactly for my hardware (mostly as reported via 
lspci)

Collecting data is easy.  Analyzing it is hard. :-)

Thanks,
B

-- 
    __   ____
   / /  / __/ Brian Lalor
  / _ \/__ \  blalor at bravo5.org
/_.__/____/  http://bravo5.org/


More information about the mythtv-users mailing list