<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>Hi ,</div>
<div> </div>
<div>Thanks for the reply.</div>
<div> </div>
<div>The platform is based on ARM Cortex A9 core. </div>
<div> </div>
<div>Regarding the Issue 1  reported :</div>
<div> </div>
<div>On analyzing the pa_simple_read , the following observations are seen.</div>
<div> </div>
<div>The delay is casued by pa_stream_peek not retuned read length , not clear on why this could fail since pa write has started.</div>
<div> </div>
<div>In pa_stream_peek , read length is returned as null , hence blocked at "pa_threaded_mainloop_wait". </div>
<div>It comes out of " pa_threaded_mainloop_wait" , and again fails at pa_stream_peek.</div>
<div>This looping happens between 5- 8 times then it returns successfully from pa_simple_read.</div>
<div> </div>
<div>We ran another test code to eliminate the influence of CPU or other application ,   The test script is as follows :</div>
<div> </div>
<div>1.  paplay -droute_test /home/test441.wav          /*  route_test is a null sink , play audio to this null sink  */</div>
<div>2. sleep 1            /* sleep for 1 sec before read */</div>
<div>3. ./test_code.sh    /*  test code to read data from the null sink  , added time stamp to measure the duration inside pa_simpe_read */</div>
<div> </div>
<div>With the above script ,  the measured time inside <i>first</i> pa_simpe_read is 1.8 sec</div>
<div> </div>
<div>The issue is not seen if paplay is immediately followed by PA read , i.e</div>
<div> </div>
<div>1.  paplay -droute_test /home/test441.wav      /* route_test is a null sink  */</div>
<div>2. ./test_code.sh    /*  test code to read data from the null sink  , added time stamp to measure the duration inside pa_simpe_read */</div>
<div> </div>
<div>With this test , the measured time inside pa_simpe_read is few micro seconds and  there is no block inside pa_simpe_read.</div>
<div> </div>
<div>when the test script was executed , no other major CPU consumption in the core.</div>
<div> </div>
<div>We are trying to understand the impact of starting the pa write earlier than pa read and the cause of this delay.</div>
<div> </div>
<div>The pa write instance is in an external application and operates independently and the instance cannot be synchronised with pa read start.</div>
<div> </div>
<div>2.  On Issue 2 ,</div>
<div> </div>
<div> The input and output both are at 44.1 Khz and no resampling of audio involved.  CPU is seen when there is no write/read hapenning.</div>
<div> </div>
<div>Is there any specific PA compile time options to be set for optimized CPU ? please let know .</div>
<div> </div>
<div>It is ARM cortex A9 at 800 MHz</div>
<div> </div>
<div> </div>
<div>Thanks & Regards</div>
<div> </div>
<div>Manjula R</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div>Message: 4</div>
<div>Date: Mon, 9 Feb 2015 18:19:38 +0530</div>
<div>From: Arun Raghavan <<a href="mailto:arun@accosted.net">arun@accosted.net</a>></div>
<div>To: General PulseAudio Discussion</div>
<div>        <<a href="mailto:pulseaudio-discuss@lists.freedesktop.org">pulseaudio-discuss@lists.freedesktop.org</a>></div>
<div>Cc: "Viswambharan, Vibin \(V.\)" <<a href="mailto:vvibin@visteon.com">vvibin@visteon.com</a>>, "Sampath,</div>
<div>        NishathKumaran \(N.\)" <<a href="mailto:nsampat2@visteon.com">nsampat2@visteon.com</a>></div>
<div>Subject: Re: [pulseaudio-discuss] PA- Performance issue with PA read</div>
<div>        and CPU consumption in idle state</div>
<div>Message-ID:</div>
<div>        <<a href="mailto:CACuU-+i2YKLcWL81QS-zBL3riU0X_+7RBfkBg-cFcrP8VaejWw@mail.gmail.com">CACuU-+i2YKLcWL81QS-zBL3riU0X_+7RBfkBg-cFcrP8VaejWw@mail.gmail.com</a>></div>
<div>Content-Type: text/plain; charset=UTF-8</div>
<div> </div>
<div>On 4 February 2015 at 16:13, Radhakrishnan, Manjula (M.)</div>
<div><<a href="mailto:rmanjula@visteon.com">rmanjula@visteon.com</a>> wrote:</div>
<div>></div>
<div>> Hi ,</div>
<div>></div>
<div>></div>
<div>></div>
<div>> We are observing performance issue with Pulse Audio in our embedded infotainment platform.</div>
<div> </div>
<div>I'm assuming embedded => ARM below.</div>
<div> </div>
<div>></div>
<div>> 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.</div>
<div>></div>
<div>></div>
<div>></div>
<div>> The audio path is as below.</div>
<div>></div>
<div>> Audio source provider -> Pulse Audio Nullsink (eg. Route_test) -> Pulse Audio Null source (eg. Route_test.monitor) ->  Audio router to sink</div>
<div>></div>
<div>></div>
<div>></div>
<div>> There are two behavioral issues observed in the Pulse Audio , below is the description of the issues.</div>
<div>></div>
<div>></div>
<div>></div>
<div>> 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.</div>
<div>></div>
<div>></div>
<div>></div>
<div>> 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 ?</div>
<div> </div>
<div>The delay sounds like a bug. It would be interesting to debug/profile</div>
<div>and see where the time is spent.</div>
<div> </div>
<div>></div>
<div>> 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.</div>
<div>></div>
<div>> 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.</div>
<div>></div>
<div>></div>
<div>></div>
<div>> 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 ?</div>
<div>></div>
<div>> Please provide your insights on the two queries.</div>
<div> </div>
<div>It would be interesting to know what CPU this is, what frequency it is</div>
<div>running at, and what kind of scaling might be happening (ideally,</div>
<div>there should be no scaling while you're measuring CPU consumption, and</div>
<div>you peg the frequency at some sensible number).</div>
<div> </div>
<div>Where the CPU utilisation is going would best be determined by</div>
<div>profiling (perf top is your friend). Things that could be going wrong</div>
<div>vary from bad drivers that wake up the CPU too often, to not having</div>
<div>your resampler (speex?) or PulseAudio compiled with the correct CPU</div>
<div>optimisations (speex needs to be compiled with correct flags depending</div>
<div>on whether you want it to work on float or int samples, and PA has</div>
<div>optimisations for ARMv6 and NEON as well).</div>
<div> </div>
<div>Regards,</div>
<div>Arun</div>
<div> </div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>Subject: Digest Footer</div>
<div> </div>
<div>_______________________________________________</div>
<div>pulseaudio-discuss mailing list</div>
<div><a href="mailto:pulseaudio-discuss@lists.freedesktop.org">pulseaudio-discuss@lists.freedesktop.org</a></div>
<div><a href="http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss">http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss</a></div>
<div> </div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>End of pulseaudio-discuss Digest, Vol 46, Issue 19</div>
<div>**************************************************</div>
<div> </div>
</span></font>
</body>
</html>