[pulseaudio-discuss] PA- Performance issue with PA read and CPU consumption in idle state

Arun Raghavan arun at accosted.net
Mon Feb 9 04:49:38 PST 2015


On 4 February 2015 at 16:13, Radhakrishnan, Manjula (M.)
<rmanjula at visteon.com> wrote:
>
> Hi ,
>
>
>
> We are observing performance issue with Pulse Audio in our embedded infotainment platform.

I'm assuming embedded => ARM below.

>
> To brief on the usage of PA in this platform , Pulse Audio is used for Audio routing from an Audio source provider to another Audio Source sink using Pulse Audio using the Null sink and Null sink.monitor.
>
>
>
> The audio path is as below.
>
> Audio source provider -> Pulse Audio Nullsink (eg. Route_test) -> Pulse Audio Null source (eg. Route_test.monitor) ->  Audio router to sink
>
>
>
> There are two behavioral issues observed in the Pulse Audio , below is the description of the issues.
>
>
>
> 1.       The Audio source provider creates a Pulse stream and writes to the Pulse Audio Nullsink before the Audio router thread has opened the Pulse Stream for reading from nullsink.monitor . In this condition , from the application Audio router ,  PA reader thread opens the PA stream and  calls the PA read API , it is blocked for more than 1 sec inside PA read API before the first read is successful.
>
>
>
> What could cause this delay in the first PA read ? Does the writer starting to write to PA first cause a delay/block on the reader when it eventually becomes active ?

The delay sounds like a bug. It would be interesting to debug/profile
and see where the time is spent.

>
> 2.       For the same issue above, on further debugging , On the PA reader side , the PA stream open is called and the stream is kept open always by the reader.  In this condition , the delay is no longer observed in the first PA read.  But this causes an impact on the CPU.
>
> When the PA stream is always open and no reads are done ,significant CPU usage is observed , PA process consumes 21 - 23 % and the threaded-m1 consumes 5 – 7 % CPU even when there is no read/write happening in PA server.
>
>
>
> Why is this high CPU observed and how to optimize the CPU , is there any configuration where the PA stream can be opened and still have low CPU consumption ?
>
> Please provide your insights on the two queries.

It would be interesting to know what CPU this is, what frequency it is
running at, and what kind of scaling might be happening (ideally,
there should be no scaling while you're measuring CPU consumption, and
you peg the frequency at some sensible number).

Where the CPU utilisation is going would best be determined by
profiling (perf top is your friend). Things that could be going wrong
vary from bad drivers that wake up the CPU too often, to not having
your resampler (speex?) or PulseAudio compiled with the correct CPU
optimisations (speex needs to be compiled with correct flags depending
on whether you want it to work on float or int samples, and PA has
optimisations for ARMv6 and NEON as well).

Regards,
Arun


More information about the pulseaudio-discuss mailing list