This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] PR libstdc++/41861 Add full steady_clock support to condition_variable


On Wednesday 04 September 2019 at 17:57:45 +0100, Mike Crowe wrote:
> On Wednesday 04 September 2019 at 17:14:30 +0100, Jonathan Wakely wrote:
> > On 04/09/19 15:49 +0100, Mike Crowe wrote:
> > > On Wednesday 04 September 2019 at 14:39:35 +0100, Jonathan Wakely wrote:
> > > > I noticed that the new tests you added in [PATCH 1/2] pass on current
> > > > trunk, even without [PATCH 2/2], is that expected?
> > > 
> > > Unfortunately, yes. CLOCK_MONOTONIC and CLOCK_REALTIME will tick at the
> > > same rate, so unless someone warps CLOCK_REALTIME during the test we can't
> > > tell the difference between the old implementation of translating
> > > steady_clock to system_clock and the new implementation that uses
> > > steady_clock directly. :( I added the tests in the hope of finding other
> > > mistakes in the new implementation rather than to reproduce the original
> > > problem.
> > 
> > OK, that was what I figured was the case. Thanks for confirming.
> > 
> > > Maybe I should add comments to the test to make that clear along the lines
> > > of those found in testsuite/27_io/objects/char/3_xin.cc ?
> > 
> > More comments are usually useful, otherwise I'll just ask the same
> > question again and again :-)
> 
> How about something like:
> 
> --8<--
> It's not possible for this test to automatically ensure that the
> system_clock test cases result in a wait on CLOCK_REALTIME and steady_clock
> test cases result in a wait on CLOCK_MONOTONIC. It's recommended to run the
> test under strace(1) and check whether the expected futex calls are made by
> glibc.
> -->8--
> 
> Unfortunately I'm unable to determine how I actually managed to run the
> test under strace. Perhaps I just compiled a similar test myself rather
> than using dejagnu. :(

Ah, I did it. Here's a new comment:

--8<--
It's not possible for this test to automatically ensure that the
system_clock test cases result in a wait on CLOCK_REALTIME and steady_clock
test cases result in a wait on CLOCK_MONOTONIC. It's recommended to run the
test under strace(1) and check whether the expected futex calls are made by
glibc. The easiest way to do this is to copy and paste the line used to
build the test from the output of:

 make -j8 check-target-libstdc++-v3 RUNTESTFLAGS="conformance.exp=30_threads/condition_variable/members/* -v -v"

to compile the test with only the tests for one clock enabled and then run it as:

 strace ./2.exe

You should see calls to:

 futex(..., FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, ...)

with large values of tv_sec when using system_clock and calls to:

 futex(..., FUTEX_WAIT_BITSET_PRIVATE, ...)

with values of tv_sec based on the system uptime when using steady_clock.
-->8--

HTH.

Mike.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]