When performing these measurements, you may want to do your recordings to linear memory and then print them afterwards. I think that stdout (printf) willould affect your measurements as gets proxied back through the main thread.
On Mon, May 10, 2021 at 12:48 PM Sarang Karandikar < [email protected]> wrote: > For easier reading, this is what is happening: > > > -------------------------------------------------------------------------------- > Thread T1(UI Thread) | Thread T2 (Non UI Thread) > | > > ----------------------------------------|--------------------------------------- > [A] PrintTime(); pthread_cond_wait() | > | > | [X] > PrintTime(); pthread_cond_signal()| > | > | > [B] PrintTime(); | > | > > -------------------------------------------------------------------------------- > > The current times printed at [A] [X] and [B] are: > [A]: t0 > [X]: t0 + k > [B]: t0 + k + [1 second - 2 seconds], > > The extra delay of 1-2 seconds at [B] is the issue, ideally it should be > no more > than the scheduler delay (10-15 ms). > > Thanks, > Sarang. > > > > On Fri, May 7, 2021 at 5:13 PM SK <[email protected]> wrote: > >> Hello, >> >> With latest EMSDK 2.0.20 I'm trying to use wait and signal using >> pthread_cond_signal() and pthread_cond_wait() functions. >> >> I'm consistently seeing this issue between two non-UI threads that after >> a pthread_cond_signal() , a previously waiting pthread_cond_timedwait() >> only comes out after 1-2 seconds delay, expectation is that it should be >> ready at max within the scheduling interval. >> >> The first row shows time just before entering wait(), later are pairs of >> times of when actual event is generated and point just before signal() is >> called, there's barely any difference. Many such events pass until we come >> out of wait and see the last 'Post wait' is printed, it takes 1.56 seconds >> to return even though event is already signaled. All times are epoch times >> retrieved via clock_gettime(CLOCK_REALTIME, ...) option. >> >> Wait start time 1620415241.405 >> >> Event generation time 1620415241.859 0.454 >> Signaling time 1620415241.859 0.454 >> >> Event generation time 1620415242.300 0.895 >> Signaling time 1620415242.300 0.895 >> >> Event generation time 1620415242.329 0.924 >> Signaling time 1620415242.329 0.924 >> >> Event generation time 1620415242.465 1.060 >> Signaling time 1620415242.465 1.060 >> >> Event generation time 1620415242.738 1.333 >> Signaling time 1620415242.738 1.333 >> >> Event generation time 1620415242.833 1.428 >> Signaling time 1620415242.833 1.428 >> >> Event generation time 1620415243.163 1.758 >> Signaling time 1620415243.163 1.758 >> >> Event generation time 1620415243.248 1.843 >> Signaling time 1620415243.249 1.844 >> >> Post wait time 1620415243.418 2.013 1.559 >> >> Any pointers would be greatly appreciated. >> >> Thanks, >> Sarang. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/0e73db37-aa12-43fc-948e-ef9622f2dc03n%40googlegroups.com >> <https://groups.google.com/d/msgid/emscripten-discuss/0e73db37-aa12-43fc-948e-ef9622f2dc03n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/CAHqdETwuTPDxPjBVmCy%2BjU5p3UKxsiwvM9R1ERFURJmrH85p0g%40mail.gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/CAHqdETwuTPDxPjBVmCy%2BjU5p3UKxsiwvM9R1ERFURJmrH85p0g%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_-LCNmyabXDfkM7R0ULXWBWGkSSLL3PGcfVff0GSEKMQ%40mail.gmail.com.
