<br><br><div><span class="gmail_quote">On 4/5/07, <b class="gmail_sendername">Artur Skawina</b> <<a href="mailto:art_k@o2.pl">art_k@o2.pl</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Well, the streamdev-client reads data from a ringbuffer and when there isn't anything<br>to read it tries to sleep for 1us and loops. This wasn't a problem when the timer<br>resolution was in the 1000..10000us range (1000..100Hz); the usleep(1) call slept
<br>for one or more milliseconds.<br>With the high-res timers in kernel 2.6.21+ usleep(1) is no longer treated as<br>usleep(10000) and the streamdev client is almost unusable; it uses most of the cpu<br>and causes hundreds of thousands context switches per second.
<br>This gets rid of the almost-busy-loop.</blockquote><div><br><br>How about his approach?<br><br>--- streamdev/client/filter.c.orig 2007-04-05 20:45:04.000000000 -0700<br>+++ streamdev/client/filter.c 2007-04-05 20:45:
44.000000000 -0700<br>@@ -135,7 +135,7 @@<br> }<br> m_RingBuffer->Del(TS_SIZE);<br> } else<br>- usleep(1);<br>+ cCondWait::SleepMs(1);
<br> }<br> } <br></div><br></div><br>