Linux 100% CPU usage when playing music, video works fine
#1
Question 
I am using XBMC 12.1 on a Zotac ION box over Ubuntu 10.04.4 LTS. I've been using this for several years now, but I recently noticed that the audio was clicking when I was playing music.

Looking into more details, I found out that the CPU is hogged. Strange thing, this onyl occurs when I play music. Playing SD/HD video works fine (even when the audio streams are MP3).

It seems that this occured when I upgraded to Frodo, but I am not 100% sure.

Here are some output of the top command for different scenario:

Playing a SD video
Code:
top - 17:37:40 up  2:26,  3 users,  load average: 0.97, 1.07, 1.10
Tasks: 209 total,   1 running, 208 sleeping,   0 stopped,   0 zombie
Cpu(s):  4.9%us,  1.1%sy,  0.5%ni, 93.4%id,  0.0%wa,  0.1%hi,  0.0%si,  0.0%st
Mem:   3353080k total,  1754092k used,  1598988k free,   135304k buffers
Swap:  2097144k total,        0k used,  2097144k free,  1180696k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
2772 xxx        20   0  452m 135m  36m S   24  4.1  16:48.43 xbmc.bin
1836 xxx         9 -11  149m 8424 6932 S    5  0.3   3:06.16 pulseaudio
3064 xxx        20   0  2568 1284  952 R    1  0.0   0:00.54 top
1255 root      20   0 60592  43m  13m S    1  1.3   4:11.50 Xorg
  870 root      20   0  8684 1648 1116 S    0  0.0   0:00.35 nmbd
    1 root      20   0  2824 1728 1236 S    0  0.1   0:01.17 init
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd

Playing a HD video (720p, DTS)
Code:
top - 17:40:03 up  2:28,  3 users,  load average: 1.07, 1.06, 1.09
Tasks: 209 total,   1 running, 208 sleeping,   0 stopped,   0 zombie
Cpu(s):  8.3%us,  2.1%sy,  0.4%ni, 89.0%id,  0.0%wa,  0.0%hi,  0.2%si,  0.0%st
Mem:   3353080k total,  1785660k used,  1567420k free,   135600k buffers
Swap:  2097144k total,        0k used,  2097144k free,  1205604k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
2772 jc        20   0  489m 144m  41m S   37  4.4  17:26.68 xbmc.bin
1836 jc         9 -11  149m 9416 7924 S    6  0.3   3:13.54 pulseaudio
1255 root      20   0 60592  43m  13m S    1  1.3   4:12.62 Xorg
3090 jc        20   0  2568 1288  952 R    1  0.0   0:00.13 top
1895 jc        20   0 23520 8916 7240 S    0  0.3   0:12.08 multiload-apple
    1 root      20   0  2824 1728 1236 S    0  0.1   0:01.17 init
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd

Playing a MP
Code:
top - 17:41:52 up  2:30,  3 users,  load average: 1.29, 1.10, 1.10
Tasks: 209 total,   1 running, 208 sleeping,   0 stopped,   0 zombie
Cpu(s): 43.6%us,  5.7%sy,  0.4%ni, 49.2%id,  0.6%wa,  0.2%hi,  0.3%si,  0.0%st
Mem:   3353080k total,  1933340k used,  1419740k free,   135656k buffers
Swap:  2097144k total,        0k used,  2097144k free,  1343148k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
2772 jc        20   0  485m 153m  38m S  197  4.7  18:34.51 xbmc.bin
1836 jc         9 -11  149m 8868 7376 S    2  0.3   3:19.39 pulseaudio
1255 root      20   0 60592  43m  13m S    2  1.3   4:13.50 Xorg
3091 jc        20   0  2568 1284  952 R    1  0.0   0:00.52 top
1070 mysql     20   0  155m  27m 6244 S    0  0.9   1:14.80 mysqld
3040 jc        20   0 13164 1900  932 S    0  0.1   0:00.04 sshd
    1 root      20   0  2824 1728 1236 S    0  0.1   0:01.17 init
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd
    3 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0
    4 root      20   0     0    0    0 S    0  0.0   0:00.09 ksoftirqd/0
    5 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0

As you can see, a sinple MP3 puts two cores to their limit...

I thought about some issue with the audio drivers or something like that, but when I play the exact same songs in the Ubunta media player, the CPU usage is very small.

I tried to play with the XBMC System settings (pretty much every possible combination), I alo tried to wipe my ~/.xbmc folder to get a cleap profile, same problem.

I am looking for some ideas on how I could troubleshoot this.

Thank you in advance.

V.
Reply
#2
I have installed Frodo 12.1 on a Linux Mint 13 system, and I do not witness this high CPU usage behavior. (The CPU is much more powerful, it is a Core i3 2100, but I do not think this matters).

Anybody has any idea on how I should proceed to diagnose where this is coming from?

Maybe I should get binaries from another (unofficial) source, any suggestion?

V.
Reply
#3
if you really run frodo on ubuntu 10.4(lucid), then your binaries _are unofficial_
We do not provide packages for ubuntu <11.10
Reply
#4
In case this can useful for somebody else : Following a HD crash, I had to resinstall the OS. I installed Xubuntu 12.04 (LTS) as well as Frodo 12.2, and the problem is gone. Yay!

V.

Code:
top - 21:42:36 up 7 min,  2 users,  load average: 0.90, 1.27, 0.66
Tasks: 160 total,   3 running, 156 sleeping,   0 stopped,   1 zombie
Cpu(s):  8.1%us,  3.7%sy,  0.4%ni, 87.6%id,  0.0%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   3096760k total,   993176k used,  2103584k free,    95860k buffers
Swap:  2097148k total,        0k used,  2097148k free,   409740k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  GROUP    COMMAND  
2420  xxx       20   0  437m 176m  39m R   32  5.8   2:39.00 xxx      xbmc.bin  
1481  root      20   0 72352  52m  21m R   11  1.7   1:01.88 root     Xorg      
2313  xxx       20   0 65440  37m 8864 S    6  1.2   0:49.18 xxx      x11vnc    
249 1 xxx       20   0  2852 1292  992 R    1  0.0   0:00.53 xxx      top      
    1 root      20   0  3528 2000 1316 S    0  0.1   0:01.76 root     init      
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 root     kthreadd  
    3 root      20   0     0    0    0 S    0  0.0   0:00.06 root     ksoftirqd/
    6 root      RT   0     0    0    0 S    0  0.0   0:00.00 root     migration/
    7 root      RT   0     0    0    0 S    0  0.0   0:00.00 root     watchdog/0
]
Reply

Logout Mark Read Team Forum Stats Members Help
100% CPU usage when playing music, video works fine0