Skip to content

Commit 380e263

Browse files
committed
more debug
1 parent eb741e9 commit 380e263

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/lost_wakeup.pass.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@
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

2426
constexpr int num_waiters = 8;
2527
constexpr int num_iterations = 10'000;
2628

2729
int 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
}

0 commit comments

Comments
 (0)