Hi all,

This is my first post here. I’m note new to audio programming or linux, but I 
haven’t done much in terms of combining the two. Most of my audio programming 
has been on os x.

Currently working on some realtime convolution with lots of channels and low 
latency requirements, but I am running into some unexpected cpu-spikes and hope 
some of you might have an idea of possible causes.

I’m processing 32 sample-blocks at 48KHz but roughly every 0,6 seconds I get a 
large spike in cpu usage. This cannot possibly be explained by my algorithm, 
because the load should be pretty stable. 

I am measuring cpu load by getting the time with 
clock_gettime(CLOCK_MONOTONIC_RAW, timespec*) at the beginning and end of each 
callback. When converted to a percentage my cpu load hovers somewhere between 
40 an 50% most of the time, but more or less every 900 callbacks (0.8 seconds 
there is a spike of more than 100%.

I am not doing any IO, mallocing or anything else that could block. My threads 
are SCHED_FIFO with max priority (I have 4 threads on 4 cores).
The only explanation I can come up with is that my threads are somehow 
pre-empted even though there are realtime threads. Is that even possible?  And 
is there a way to check this? Besides pre-emption maybe my caches are severely 
thrashed but i find that unlikely as it seems to happen on all 4 cores 
simultaneously. 

I’m running (more or less default install, no additional services run-in) Linux 
Mint 17.3 with a 3.19.0-42-lowlatency kernel on a core i7-6700 with 
hyperthreading/turbo disabled.

I remember reading somewhere that realtime threads cannot run more than .95s 
every second. That would be very bad if it actually meant my threads are 
blocked  run for a period of 50ms straight…

Anyone have any thoughts on possible causes?

best,
Fokke


_______________________________________________
Linux-audio-dev mailing list
[email protected]
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Reply via email to