Lumiera  0.pre.03
»edit your freedom«
typed-counter-test.cpp File Reference

Go to the source code of this file.

Description

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.

See also
thread-wrapper-test.cpp
thread-wrapper-join-test.cpp

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>

Classes

struct  TypedCounter_test::Dummy< i >
 parametrised marker type to designate a counter to be incremented More...
 
class  TypedCounter_test
 

Functions

 LAUNCHER (TypedCounter_test, "unit common")
 Register this test class... More...
 

Variables

const uint MAX_INDEX = 10
 number of distinct types / counters
 
const uint NUM_ITERATIONS = 10000
 number of repeated random accesses per Thread
 
const uint NUM_THREADS = 100
 number of threads to run in parallel
 

Namespaces

 lib
 Implementation namespace for support and library code.
 

Class Documentation

◆ lib::test::TypedCounter_test::Dummy

struct lib::test::TypedCounter_test::Dummy
+ Collaboration diagram for TypedCounter_test::Dummy< i >:

Function Documentation

◆ LAUNCHER()

lib::test::LAUNCHER ( TypedCounter_test  ,
"unit common"   
)

Register this test class...