![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
Stress test to verify type-based contexts. More...
Go to the source code of this file.
Stress test to verify type-based contexts.
Besides a simple usage (unit) test, this test performs a massively multithreaded test of the type-based contexts, through use of the TypedCounter. The idea behind this facility is to provide a context, in which type-IDs can be allocated. In the case of the TypedCounter, these type-IDs are used to index into a vector of counters, this way allowing to access a counter for a given type.
This test builds several "families", each sharing a TypedCounter. Each of these families runs a set of member threads, which concurrently access the TypedCounter of this family. After waiting for all threads to finish, we compare the checksum built within the target objects with the checksum collected through the TypedCounters.
Definition in file typed-counter-test.cpp.
#include "lib/test/run.hpp"#include "lib/typed-counter.hpp"#include "lib/test/microbenchmark.hpp"#include "lib/random.hpp"#include "lib/util.hpp"#include <cstdlib>#include <utility>#include <array>Namespaces | |
| namespace | lib |
| Implementation namespace for support and library code. | |
| namespace | lib::test |
| Unit tests for the Lumiera support library. | |
| namespace | lib::test::anonymous_namespace{typed-counter-test.cpp} |
Classes | |
| class | TypedCounter_test |
| struct | TypedCounter_test::Dummy< i > |
| parametrised marker type to designate a counter to be incremented More... | |
Functions | |
| LAUNCHER (TypedCounter_test, "unit common") | |
| Register this test class... | |
Variables | |
| const uint | MAX_INDEX = 10 |
| number of distinct types / counters | |
| const uint | NUM_THREADS = 100 |
| number of threads to run in parallel | |
| const uint | NUM_ITERATIONS = 10000 |
| number of repeated random accesses per Thread | |
| struct lib::test::TypedCounter_test::Dummy |
Collaboration diagram for TypedCounter_test::Dummy< i >: