Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#116 sdl unit eats all cpu time

open
Dan Dennedy
sdl module (5)
5
2011-05-29
2011-05-27
No

sdl unit in pause state eaither eat all CPU or makes xorg eat all CPU time.

if SDL window is hidden under the others thread with id 16408 eats all CPU time...

top - 10:22:11 up 21:27, 7 users, load average: 1.00, 1.00, 0.95
Tasks: 246 total, 3 running, 243 sleeping, 0 stopped, 0 zombie
Cpu(s): 53.2%us, 1.5%sy, 0.0%ni, 44.9%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 8260008k total, 2454292k used, 5805716k free, 114048k buffers
Swap: 5439484k total, 0k used, 5439484k free, 1990068k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16408 studio 20 0 142m 52m 6680 R 98.9 0.6 24:44.25 melted
16409 studio 20 0 142m 52m 6680 R 5.3 0.6 1:18.25 melted
1235 root 20 0 96000 53m 12m S 3.0 0.7 19:18.18 Xorg
1508 studio 20 0 112m 14m 9884 S 1.0 0.2 0:10.19 gnome-terminal
16407 studio 20 0 142m 52m 6680 S 0.7 0.6 0:05.90 melted
603 root 20 0 0 0 0 S 0.3 0.0 1:25.38 blackmagicd
14832 root 20 0 2836 1104 772 S 0.3 0.0 0:11.73 top
15382 studio 20 0 270m 51m 25m S 0.3 0.6 0:00.93 firefox
1 root 20 0 2872 1360 1160 S 0.0 0.0 0:00.89 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd

if SDL window is visible, then Xorg eats all cpu:

top - 10:28:16 up 21:33, 7 users, load average: 0.99, 1.02, 0.97
Tasks: 249 total, 2 running, 247 sleeping, 0 stopped, 0 zombie
Cpu(s): 42.6%us, 32.1%sy, 0.0%ni, 25.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8260008k total, 2466108k used, 5793900k free, 114648k buffers
Swap: 5439484k total, 0k used, 5439484k free, 1995508k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1235 root 20 0 97632 55m 13m R 95.0 0.7 19:47.67 Xorg
16408 studio 20 0 142m 52m 6680 S 48.5 0.6 30:35.79 melted
16409 studio 20 0 142m 52m 6680 S 3.0 0.6 1:36.96 melted
16407 studio 20 0 142m 52m 6680 S 1.7 0.6 0:07.67 melted
14832 root 20 0 2836 1104 772 S 0.3 0.0 0:12.83 top
15382 studio 20 0 270m 51m 25m S 0.3 0.6 0:01.03 firefox
1 root 20 0 2872 1360 1160 S 0.0 0.0 0:00.89 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.42 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:02.99 migration/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.03 migration/1

gdb log:

[studio@dev-4 melted]$ gdb --args ./melted -test -c /tmp/test1.conf
GNU gdb (GDB) Fedora (7.2-51.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/src/mltframework.org/melted.git/src/melted/melted...done.
(gdb) r
Starting program: /usr/local/src/mltframework.org/melted.git/src/melted/melted -test -c /tmp/test1.conf
[Thread debugging using libthread_db enabled]
(5) Starting server on 5250.
(7) 0: 201 OK
(7) 1: UADD sdl:320x240
(7) 2: 201 OK
(7) 3: U0
(7) 4:
[New Thread 0xb7fefb70 (LWP 16384)]
(5) /usr/local/src/mltframework.org/melted.git/src/melted/melted version 0.3.11 listening on port 5250
[New Thread 0xb75ffb70 (LWP 16391)]
(5) Connection established with localhost (9)
[New Thread 0xb6bffb70 (LWP 16392)]
(5) Connection established with localhost (10)
(6) localhost "ULS" 201
(6) localhost "NLS" 201
(6) localhost "CLS "/"" 201
(6) localhost "LIST U1" 403
(6) localhost "CLS "/home/"" 201
(6) localhost "LOAD U1 "!/home/13192.dv"" 403
(6) localhost "PLAY U1 1000" 403
(6) localhost "LOAD U1 "!/home/13192.dv"" 403
(6) localhost "PLAY U1 1000" 403
(7) loaded clip /home/13192.dv
(6) localhost "LOAD U0 "!/home/13192.dv"" 200
[New Thread 0xb1bbfb70 (LWP 16404)]
[New Thread 0xb13beb70 (LWP 16405)]
[New Thread 0xb0bbdb70 (LWP 16406)]
[Thread 0xb1bbfb70 (LWP 16404) exited]
[Thread 0xb0bbdb70 (LWP 16406) exited]
[Thread 0xb13beb70 (LWP 16405) exited]
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4663:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM default
[New Thread 0xb13beb70 (LWP 16407)]
(6) localhost "PLAY U0 1000" 200
[New Thread 0xb0bbdb70 (LWP 16408)]
(6) localhost "LIST U0" 200
[New Thread 0xb1bbfb70 (LWP 16409)]
(6) localhost "PAUSE U0" 200
(5) Connection with localhost (9) closed
[Thread 0xb75ffb70 (LWP 16391) exited]
(5) Connection with localhost (10) closed
[Thread 0xb6bffb70 (LWP 16392) exited]

Discussion

  • Dan Dennedy
    Dan Dennedy
    2011-05-27

    Does your X11 driver support the XVideo extension? Run 'xvinfo' to find out. If not, then full framerate video playout on X11 with most players will have a lot of overhead. When paused, the sdl consumer continues to update the frame at the playout frame rate. The sdl_preview consumer includes an optimization for the pause state which makes it only update while paused when the application explicitly requests a repaint (by setting its property refresh=1). So, you might want to try using sdl_preview instead.

     
  • Dan Dennedy
    Dan Dennedy
    2011-05-27

    Ohh, another big factor I see from your output is the lack of ALSA or at least unable to open ALSA. Please consider setting audio_off=1 on the consumer as well as using sdl_preview. It might be nice to make an improvement in this area, but I do not plan to address it soon due to other priorities. Either submit a patch or leave this open and use the workarounds.

     
    • status: open --> closed
     
  • fixing ALSA solves a problem - pausing sdl unit do not eat 100% cpu.
    using sdl_preview is actually another possible fix - pausing sdl_preview makes CPU almost idle..

     
  • Dan Dennedy
    Dan Dennedy
    2011-05-29

    I want to leave this open because there is a bug here, and others might run into it.

     
  • Dan Dennedy
    Dan Dennedy
    2011-05-29

    • status: closed --> open