30 using std::atomic_uint;
31 using std::this_thread::yield;
32 using std::this_thread::sleep_for;
33 using std::chrono::microseconds;
41 const uint NUM_THREADS = 200;
42 const uint REPETITIONS = 10;
70 Thread thread(
"counter", [&]{ ++i; });
71 while (thread) yield();
100 doIt (uint a, uint b)
103 sleep_for (microseconds{sum});
112 size_t globalSum = 0;
113 auto launchThreads = [&]
115 for (uint i=1; i<=NUM_THREADS; ++i)
118 globalSum += (i + x);
119 threads.emplace (&TestThread::doIt, i, x);
122 while (
explore(threads).has_any())
125 for (
auto& t : threads)
134 CHECK (checkSum == globalSum);
135 CHECK (runTime < NUM_THREADS * 1000/2);
A fixed collection of non-copyable polymorphic objects.
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
void verifyConcurrentExecution()
int rani(uint bound=_iBOUND())
Functions to perform (multithreaded) timing measurement on a given functor.
Implementation namespace for support and library code.
Managing a collection of non-copyable polymorphic objects in compact storage.
double benchmarkTime(FUN const &invokeTestCode, const size_t repeatCnt=1)
Helper to invoke a functor or λ to observe its running time.
Abstract Base Class for all testcases.
Simplistic test class runner.
void seedRand()
draw a new random seed from a common nucleus, and re-seed the default-Gen.
Convenience front-end to simplify and codify basic thread handling.
void demonstrateSimpleUsage()
A thin convenience wrapper to simplify thread-handling.
Building tree expanding and backtracking evaluations within hierarchical scopes.