Re: ALSA processor usage is too high

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
> while(1)
> {
>   processNextAlsaStream();
>   processMp3Decoder();
>   processLCD();
>   processInputs();
>   processSerial();
> }

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux