|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Namespaces | |
| namespace | detail |
Classes | |
| class | BipartiteNetworkGenerator |
| Complete bipartite network generator. More... | |
| class | Deterministic_Start_Gate |
| Single-use deterministic start gate for concurrent tests. More... | |
| class | ErdosRenyiGenerator |
| Erdős–Rényi random network generator. More... | |
| class | GridNetworkGenerator |
| Grid network generator. More... | |
| struct | has_cost_support |
| struct | has_cost_support< Net, std::void_t< decltype(std::declval< typename Net::Arc >().cost)> > |
| class | LayeredNetworkGenerator |
| Layered (staged) network generator. More... | |
| struct | NetworkGeneratorConfig |
| Random network generator configuration. More... | |
| struct | Producer_Consumer_Stress_Config |
| Configuration for producer/consumer stress helpers. More... | |
| struct | Producer_Consumer_Stress_Result |
| Result returned by producer/consumer stress helpers. More... | |
| class | RandomNetworkGenerator |
| Base class for random network generators. More... | |
| struct | Trace_Operation |
| One randomized operation trace entry. More... | |
Enumerations | |
| enum class | Trace_Operation_Kind { push , pop , insert , erase , contains } |
| Operation kind for randomized reference traces. More... | |
Functions | |
| template<typename Worker > | |
| void | run_workers (const size_t thread_count, Worker worker) |
Launch thread_count workers with a deterministic simultaneous start, join every one of them, and rethrow the first worker exception (if any) only after all have joined. | |
| template<typename Push , typename TryPop > | |
| Producer_Consumer_Stress_Result | run_producer_consumer_stress (const Producer_Consumer_Stress_Config &config, Push push, TryPop try_pop) |
| Run a deterministic producer/consumer stress scenario. | |
| std::vector< Trace_Operation > | make_random_operation_trace (const size_t count, const uint32_t seed, const size_t key_range, const std::initializer_list< Trace_Operation_Kind > kinds={ Trace_Operation_Kind::insert, Trace_Operation_Kind::erase, Trace_Operation_Kind::contains }) |
| Build a deterministic pseudo-random operation trace. | |
| template<typename SubjectStep , typename ReferenceStep > | |
| std::vector< size_t > | replay_trace_and_collect_mismatches (const std::vector< Trace_Operation > &trace, SubjectStep subject_step, ReferenceStep reference_step) |
| Replay a trace against a subject and a reference implementation. | |
| template<class Net > | |
| std::unique_ptr< RandomNetworkGenerator< Net > > | create_generator (const std::string &type, const NetworkGeneratorConfig &config) |
| Factory function to create generators. | |
Operation kind for randomized reference traces.
| Enumerator | |
|---|---|
| push | |
| pop | |
| insert | |
| erase | |
| contains | |
Definition at line 430 of file concurrency_test_utils.H.
| std::unique_ptr< RandomNetworkGenerator< Net > > Aleph::Testing::create_generator | ( | const std::string & | type, |
| const NetworkGeneratorConfig & | config | ||
| ) |
Factory function to create generators.
Definition at line 462 of file random_network_generator.H.
|
inline |
Build a deterministic pseudo-random operation trace.
| [in] | count | Number of operations to generate. |
| [in] | seed | Random seed. |
| [in] | key_range | Exclusive upper bound for generated keys. |
| [in] | kinds | Allowed operation kinds. |
key_range > 0. kinds.size() > 0. Definition at line 468 of file concurrency_test_utils.H.
References make_random_operation_trace().
Referenced by make_random_operation_trace(), TEST(), TEST(), TEST(), and TEST().
| std::vector< size_t > Aleph::Testing::replay_trace_and_collect_mismatches | ( | const std::vector< Trace_Operation > & | trace, |
| SubjectStep | subject_step, | ||
| ReferenceStep | reference_step | ||
| ) |
Replay a trace against a subject and a reference implementation.
| SubjectStep | Callable invoked as subject_step(operation). |
| ReferenceStep | Callable invoked as reference_step(operation). |
| [in] | trace | Operation trace to replay. |
| [in,out] | subject_step | Subject implementation step. |
| [in,out] | reference_step | Reference implementation step. |
Definition at line 511 of file concurrency_test_utils.H.
References replay_trace_and_collect_mismatches().
Referenced by replay_trace_and_collect_mismatches(), TEST(), and TEST().
| Producer_Consumer_Stress_Result Aleph::Testing::run_producer_consumer_stress | ( | const Producer_Consumer_Stress_Config & | config, |
| Push | push, | ||
| TryPop | try_pop | ||
| ) |
Run a deterministic producer/consumer stress scenario.
| Push | Callable invoked as push(size_t value). It may return void for always-successful pushes or bool for retryable pushes. Must be safe to copy into one closure per producer thread; each thread runs its own copy (so Push itself need not be thread-safe unless it captures shared state). |
| TryPop | Callable invoked as try_pop(size_t &out) returning true when a value was consumed. Same per-thread-copy contract as Push. |
| [in] | config | Stress dimensions and timeout. |
| [in,out] | push | Producer operation. |
| [in,out] | try_pop | Consumer operation. |
The helper assigns unique values in [0, producers * items_per_producer). It does not assume FIFO ordering; callers should verify conservation, ordering, or topology-specific properties separately.
| std::system_error | propagated as-is if the underlying std::thread constructor fails to create a thread; threads already launched are unblocked and joined (never left parked on the gate or abandoned joinable) before this propagates. |
| Whatever | the first producer/consumer worker throws (e.g. from push/try_pop itself), once every thread has been joined – see run_workers(), which this delegates to. |
Definition at line 360 of file concurrency_test_utils.H.
References Aleph::Testing::Producer_Consumer_Stress_Result::consumed, Aleph::Testing::Producer_Consumer_Stress_Config::consumers, Aleph::Testing::Producer_Consumer_Stress_Config::items_per_producer, Aleph::Testing::Producer_Consumer_Stress_Config::producers, push, run_producer_consumer_stress(), run_workers(), and Aleph::Testing::Producer_Consumer_Stress_Config::timeout.
Referenced by run_producer_consumer_stress(), TEST(), TEST(), and TEST().
Launch thread_count workers with a deterministic simultaneous start, join every one of them, and rethrow the first worker exception (if any) only after all have joined.
| Worker | Callable invoked as worker(size_t index) from its own thread, index in [0, thread_count). Must be safe to copy into one closure per thread; each thread runs its own copy (so Worker itself need not be thread-safe unless it captures shared state). |
| [in] | thread_count | Number of worker threads to launch. |
| [in,out] | worker | Per-worker callable. |
| std::invalid_argument | if thread_count == 0 (see Deterministic_Start_Gate's constructor). |
| std::system_error | propagated as-is if the underlying std::thread constructor fails to create a thread; threads already launched are unblocked and joined (never left parked on the gate or abandoned joinable) before this propagates. |
| Whatever | the first worker to throw at runtime propagates with (whichever worker's catch block first acquires the internal exception mutex – not necessarily the one with the smallest index), rethrown only once every thread has been launched, released, and joined. If more than one worker throws, only the first one recorded is rethrown; the others are discarded. |
Definition at line 255 of file concurrency_test_utils.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by run_producer_consumer_stress(), TEST(), and TEST().