[alsa-devel] ALSA processor usage is too high
broonie at opensource.wolfsonmicro.com
Sat Nov 6 06:30:35 CET 2010
On Fri, Nov 05, 2010 at 03:27:01PM -0400, Adam Rosenberg wrote:
> avail_update was the only reliable method. Could you provide an
> alternative example that is known to work with multiple streams in the
> same application?
poll() is designed for this application.
> Sorry for the confusion, the main loop of my application basically does this:
What you appear to be saying here is that your application which busy
waits is consuming a lot of CPU - this isn't entirely surprising, as
with many APIs in Linux the ALSA APIs are designed to be event driven.
If you really need to do this I'd suggest having all the functions which
can wait for input (at a guess at least the ALSA, input and serial ones)
converted to wait for events on their fds using poll(), epoll() or
whatever and if you desperately need to busy wait then do this by using
poll() on an epoll fd with a timeout of zero. This will reduce the
overhead you incur for busy waiting.
More information about the Alsa-devel