PDA

View Full Version : How do I check CPU/memory usage while running MythTV?



dtaylorl
December 27th, 2010, 07:22 PM
I'm wondering just what the title asks. Video playback drops frames from time to time and I want to test to see if its because my hardware is underpowered. I would also like to test my CPU load while during HD playback.

4dognight
December 27th, 2010, 08:35 PM
You can run 'vmstat 2'
or
'top'

in a terminal.

I prefer vmstat. It will show you all that you ask and more.

LowSky
December 27th, 2010, 08:55 PM
I like running htop (you need to install it first)

its a bit better than regular top

dtaylorl
December 27th, 2010, 09:32 PM
Ok, thanks. I'll give those a try. Is there a way to view the info live as MythTV is running, or do I have to exit myth and then view the output?

4dognight
December 27th, 2010, 09:41 PM
If your frontend is starting automatically, which is default. You can exit the frontend, open a terminal and run whichever of the 3 commands mentioned you prefer. Then start the frontend from the menu. While the frontend is then running, you can ALT-tab back to the terminal window to see what it is up to.

dtaylorl
December 27th, 2010, 10:45 PM
Perfect, I always forget about the ALT-tab combo. I actually ended up connecting to the machine remotely via SSH instead. My CPU usage is fine (~30%), but it looks like I am using a fair bit of swap space to meet my memory requirements. How does vmstat report the amount of memory used? It says my swpd is 155244. Is that ~155MB? I have a decent amount of RAM in the machine (1GB I think)... is it normal for MythTV to use more than that? If so I guess I'll upgrade it.

4dognight
December 27th, 2010, 11:30 PM
vmstat defaults to KB, so you have 155MB swapped. If you have sufficient memory and want to prevent swapping, as linux will swap by default, even with sufficient memory. You can add vm.swappiness=0 to /etc/sysctl.conf, and reboot. This will make linux avoid swapping as much as possible. Mythtv isnt really memory hungry. Do you have anything else running on the server?
If you run top or htop, you can have it sort on mem usage to see where its being allocated.

dtaylorl
December 28th, 2010, 12:24 AM
Because vmstat was showing more memory allocated to swap than was free I assumed that it was only using a swap because there wasn't enough space on the physical RAM (running vmstat on my laptop shows 0 for swpd). Additionally, I assumed that the remaining "free space" was on the swap. Now that I've run vmstat I see that this isn't the case. I have 768MB of Ram and there are still a few MB of free space on it... but not much. After ~5 minutes of TV playback I'm down to only 8MB of free space. We'll see if this runs out as I continue watching.

Edit: My swap space is up to almost 2GB. Is there any chance that this could hurt performance?

4dognight
December 28th, 2010, 04:57 AM
if you have swapped out 2gb, that is bad, very bad.
Can you post your top display sorted by memory.

dtaylorl
December 28th, 2010, 05:05 AM
I should point out that most of those 2GB aren't being used... only 169MB - the rest is free. So I'm not sure why there is so much being allocated to swap. mythfrontend is basically the only process using any memory or CPU.

4dognight
December 28th, 2010, 05:11 AM
Oh, I thought you had 2gb swapped out.
Still , try setting the vm.swappiness as i previously mentioned.

keepitsimpleengr
December 28th, 2010, 07:42 AM
I like running htop (you need to install it first)

its a bit better than regular top

Great advice!

HTOP is great for MYTHTV. It runs in a terminal window. I usually run it on one of the 4 desktops but you can also run it from a console (Alt-TAB-Fn). It has a text based customizable graphical display which is good for quick glances.

You can kill programs if run as "sudo htop", and has convenient function key operations such as search, easy column sort selection and search. You can also customize it and use colors.

kyphos
December 29th, 2010, 04:21 AM
Great advice!

You can kill programs if run as "sudo htop", and has convenient function key operations such as search, easy column sort selection and search. You can also customize it and use colors.

How does one go about finding "htop" and then install it on a Mythbuntu system??
(please assume minimal familiarity with Ubuntu).

Thanks.

4dognight
December 29th, 2010, 03:24 PM
from a terminal, type in

sudo apt-get install htop

kyphos
December 29th, 2010, 03:39 PM
@4dognight,
Thanks!!