Csound Csound-dev Csound-tekno Search About

csound5 with alsa, IRQ, and fluctuation cpu usage

Date2006-01-06 21:21
FromAtte André Jensen
Subjectcsound5 with alsa, IRQ, and fluctuation cpu usage
Hi

I've tried running csound5 with alsa on my edirol usb soundcard, and 
it's quite strange. When running with alsa on my onboard top shows 
something like this all the time:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  7166 atte      15   0 35884  30m 4412 S 12.3  6.1   0:04.50 csound
  2874 root     -41  -5     0    0    0 S  0.7  0.0   0:00.37 IRQ 10

That is to be expected, since the csd I run has a few always-on 
instruments that does fx (freeverb, stereo chorus, and a handfull of 
delays). However when I run on the edirol usb soundcard I most of the 
time can't even see csound on top, even if I play instruments and with 
the same always-on fx instruments. Then every 30 seconds or so I first 
see an IRQ using lots of cpu:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  2784 root     -42  -5     0    0    0 S 33.6  0.0   0:09.32 IRQ 5
  6608 atte      15   0 36020  29m 4424 S 13.6  5.9   0:17.30 csound
  4616 atte      16   0 12316 7768 6444 S  0.7  1.5   0:01.67 fbpanel
   713 root     -49  -5     0    0    0 S  0.3  0.0   0:00.79 IRQ 12
     1 root      16   0  1876  728  720 S  0.0  0.1   0:00.46 init
     2 root       5 -10     0    0    0 S  0.0  0.0   0:00.45 ksoftirqd/0
     3 root       5 -10     0    0    0 S  0.0  0.0   0:00.04 desched/0


and then after a few seconds csound gets crazy:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  6608 atte      16   0 36020  29m 4424 S 68.5  5.9   0:23.39 csound
   713 root     -49  -5     0    0    0 S  0.3  0.0   0:00.83 IRQ 12
     1 root      16   0  1876  728  720 S  0.0  0.1   0:00.46 init
     2 root       5 -10     0    0    0 S  0.0  0.0   0:00.46 ksoftirqd/0

And the most strange of it all is that through it all csound performs 
without a glitch, I can press it hard even when it's idle and using 
about 70% cpu. However when I leave it running alone it will sometimes 
become unresponsive after a few minutes.

What's going on here? Is it top that's confused, is csound really using 
all that cpu, and why doesn't it even use 0.1% when I bang it between 
cpu-peaks? Is there another more acurate way of measuring cpu usage that 
will speak the truth?

I run csound5 from december 28 on a P4 2.4Ghz laptop under 
debian/unstable with the realtime patched kernel from demudi. I compiled 
csound5 with the following options:

scons usePortAudio=0 noDebug=1 buildCsoundVST=0 gcc3opt=pentium4

-- 
peace, love & harmony
Atte

http://www.atte.dk

Date2006-01-06 21:40
FromIain Duncan
SubjectRe: csound5 with alsa, IRQ, and fluctuation cpu usage
I don't know the answers to your problems, but I do know that getting 
rid of that USB sound card and getting a firewire or internal is the way 
to go. USB is fine for midi, and a total pain for low latency high 
performance audio. If you're not on a laptop, sell it and get a used 
M-audio or Echo or something! If on laptop, I think firewire is the only 
way to go.

Iain

Atte André Jensen wrote:
> Hi
> 
> I've tried running csound5 with alsa on my edirol usb soundcard, and 
> it's quite strange. When running with alsa on my onboard top shows 
> something like this all the time:
> 
>   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
>  7166 atte      15   0 35884  30m 4412 S 12.3  6.1   0:04.50 csound
>  2874 root     -41  -5     0    0    0 S  0.7  0.0   0:00.37 IRQ 10
> 
> That is to be expected, since the csd I run has a few always-on 
> instruments that does fx (freeverb, stereo chorus, and a handfull of 
> delays). However when I run on the edirol usb soundcard I most of the 
> time can't even see csound on top, even if I play instruments and with 
> the same always-on fx instruments. Then every 30 seconds or so I first 
> see an IRQ using lots of cpu:
> 
>   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
>  2784 root     -42  -5     0    0    0 S 33.6  0.0   0:09.32 IRQ 5
>  6608 atte      15   0 36020  29m 4424 S 13.6  5.9   0:17.30 csound
>  4616 atte      16   0 12316 7768 6444 S  0.7  1.5   0:01.67 fbpanel
>   713 root     -49  -5     0    0    0 S  0.3  0.0   0:00.79 IRQ 12
>     1 root      16   0  1876  728  720 S  0.0  0.1   0:00.46 init
>     2 root       5 -10     0    0    0 S  0.0  0.0   0:00.45 ksoftirqd/0
>     3 root       5 -10     0    0    0 S  0.0  0.0   0:00.04 desched/0
> 
> 
> and then after a few seconds csound gets crazy:
> 
>   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
>  6608 atte      16   0 36020  29m 4424 S 68.5  5.9   0:23.39 csound
>   713 root     -49  -5     0    0    0 S  0.3  0.0   0:00.83 IRQ 12
>     1 root      16   0  1876  728  720 S  0.0  0.1   0:00.46 init
>     2 root       5 -10     0    0    0 S  0.0  0.0   0:00.46 ksoftirqd/0
> 
> And the most strange of it all is that through it all csound performs 
> without a glitch, I can press it hard even when it's idle and using 
> about 70% cpu. However when I leave it running alone it will sometimes 
> become unresponsive after a few minutes.
> 
> What's going on here? Is it top that's confused, is csound really using 
> all that cpu, and why doesn't it even use 0.1% when I bang it between 
> cpu-peaks? Is there another more acurate way of measuring cpu usage that 
> will speak the truth?
> 
> I run csound5 from december 28 on a P4 2.4Ghz laptop under 
> debian/unstable with the realtime patched kernel from demudi. I compiled 
> csound5 with the following options:
> 
> scons usePortAudio=0 noDebug=1 buildCsoundVST=0 gcc3opt=pentium4
> 

Date2006-01-06 22:49
FromAtte André Jensen
SubjectRe: csound5 with alsa, IRQ, and fluctuation cpu usage
Iain Duncan wrote:
> If on laptop, I think firewire is the only 
> way to go.

I heard that one before :-)

Well, now that I have it (had it for over a year) I'd like to use it. 
Since it works flawlessly with jack, I figured it's something that can 
be done...

-- 
peace, love & harmony
Atte

http://www.atte.dk

Date2006-01-06 22:53
FromAtte André Jensen
SubjectRe: csound5 with alsa, IRQ, and fluctuation cpu usage
Iain Duncan wrote:

> If on laptop, I think firewire is the only 
> way to go.

Maybe you could even recommend a firewire card, stereo in/out, maybe 
with a decent mic preamp + headphones out + volume knop what works well 
with linux/csound?

-- 
peace, love & harmony
Atte

http://www.atte.dk

Date2006-01-06 22:56
FromIain Duncan
SubjectRe: csound5 with alsa, IRQ, and fluctuation cpu usage
>> If on laptop, I think firewire is the only way to go.
> 
> 
> Maybe you could even recommend a firewire card, stereo in/out, maybe 
> with a decent mic preamp + headphones out + volume knop what works well 
> with linux/csound?

I haven't been in the market lately so I am out of touch, but if you 
asked on linux audio users you'd get good responses I'm sure.

Iain

Date2006-01-06 23:01
FromAtte André Jensen
SubjectRe: csound5 with alsa, IRQ, and fluctuation cpu usage
Iain Duncan wrote:

> I haven't been in the market lately so I am out of touch, but if you 
> asked on linux audio users you'd get good responses I'm sure.

Sure, I'll do that...

-- 
peace, love & harmony
Atte

http://www.atte.dk

Date2006-01-08 17:46
FromJonathan Murphy
SubjectRe: csound5 with alsa, IRQ, and fluctuation cpu usage
Iain Duncan wrote:

>>> If on laptop, I think firewire is the only way to go.
>>
>>
>>
>> Maybe you could even recommend a firewire card, stereo in/out, maybe 
>> with a decent mic preamp + headphones out + volume knop what works 
>> well with linux/csound?
>
>
> I haven't been in the market lately so I am out of touch, but if you 
> asked on linux audio users you'd get good responses I'm sure.
>
> Iain

To the best of my knowledge firewire support is still in its infancy. 
It's not (yet) the way to go on linux. This is the relevant project page:

http://freebob.sourceforge.net/index.php/Main_Page

Have you tried running csound as root with the --sched option in your 
command line? Also have you made sure that your .asoundrc or 
/etc/asound.conf is set up to minimise software mixing? This is just a 
guess based on the ksoftirqd/0 which is showing up when you're using the 
USB card. Also the Demudi multimedia kernel is getting kind of old, 
maybe you should try current stable kernel with the Molnar 
realtime-preempt patches:

http://people.redhat.com/mingo/realtime-preempt/

Jonathan.

Date2006-01-12 10:12
FromAtte André Jensen
SubjectRe: csound5 with alsa, IRQ, and fluctuation cpu usage
Jonathan Murphy wrote:

> Have you tried running csound as root with the --sched option in your 
> command line?

No, but I think the multimedia kernel lets non-root users run with 
higher priviledges. At least I can run with --sched as myself.

 > Also have you made sure that your .asoundrc or
> /etc/asound.conf is set up to minimise software mixing? This is just a 
> guess based on the ksoftirqd/0 which is showing up when you're using the 
> USB card.

No. Could you provide a link to information about how this is achieved?

 > Also the Demudi multimedia kernel is getting kind of old,
> maybe you should try current stable kernel with the Molnar 
> realtime-preempt patches:
> 
> http://people.redhat.com/mingo/realtime-preempt/

I'll give that a try over the weekend...

-- 
peace, love & harmony
Atte

http://www.atte.dk