File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1414// <atomic>
1515
1616#include < atomic>
17+ #include < chrono>
1718#include < functional>
1819#include < thread>
1920#include < vector>
2021#include < iostream>
22+ #include < iomanip>
2123
2224#include " make_test_thread.h"
2325
2426constexpr int num_waiters = 8 ;
2527constexpr int num_iterations = 10'000 ;
2628
2729int main (int , char **) {
30+ auto start = std::chrono::high_resolution_clock::now ();
2831 for (int run = 0 ; run < 20 ; ++run) {
2932 std::cerr << " run " << run << std::endl;
3033 std::atomic<int > waiter_ready (0 );
@@ -41,7 +44,9 @@ int main(int, char**) {
4144 auto notify = [&] {
4245 for (int i = 0 ; i < num_iterations; ++i) {
4346 if (i % 1000 == 0 )
44- std::cerr << " run " << run << " notify iteration " << i << std::endl;
47+ std::cerr << std::fixed << std::setprecision (2 ) << std::left
48+ << std::chrono::duration<double >(std::chrono::high_resolution_clock::now () - start) << " run "
49+ << run << " notify iteration " << i << std::endl;
4550
4651 while (waiter_ready.load () < num_waiters) {
4752 std::this_thread::yield ();
@@ -59,5 +64,5 @@ int main(int, char**) {
5964 threads.push_back (support::make_test_jthread (notify));
6065 }
6166
62- return 0 ;
67+ return 1 ;
6368}
You can’t perform that action at this time.
0 commit comments