Adam Rosenberg wrote:
On Fri, Nov 5, 2010 at 10:31 AM, Clemens Ladisch clemens@ladisch.de wrote:
How much CPU does "aplay -D hw -t raw -f dat /dev/zero" use?
I do not know how to calculate CPU usage for a given process.
The time utility (if you have it) measures both elapsed and actually used CPU time.
For the audio playback I am polling the streams using snd_pcm_avail_update() and then writing the number of frames available using snd_pcm_writei().
And what does your program do when avail_update returns 0 frames?
I am able to add aplay for testing so I used your command to open the 8 streams, removed the audio processing from my application, and ran the test again. The result was 4 minutes and 35 seconds, which is basically the same as the result from the test within my application and much too slow.
You cannot write data faster than it's playing; the audio ring buffer has a finite size.
You would have a problem if the processing and/or the driver would make everything so slow that you wouldn't be able to write new data to the device fast enough, which would result in an buffer underrun. Does this actually happen?
Regards, Clemens