Lumiera  0.pre.03
»edit your freedom«
WorkForce_test Class Reference

Description

Test:
WorkForce-Service: maintain a pool of active worker threads.
Warning
this test relies on empirical timings and can be brittle.
See also
SchedulerUsage_test

Definition at line 112 of file work-force-test.cpp.

Private Member Functions

virtual void run (Arg)
 
void simpleUsage ()
 
void verify_countActive ()
 
void verify_defaultPool ()
 
void verify_detectError ()
 
void verify_dtor_blocks ()
 
void verify_finalHook ()
 
void verify_pullWork ()
 
void verify_scalePool ()
 
void verify_workerDismiss ()
 
void verify_workerHalt ()
 
void verify_workerRetard ()
 
void verify_workerSleep ()
 

Additional Inherited Members

- Public Member Functions inherited from Test
virtual void run (Arg arg)=0
 

Member Function Documentation

◆ simpleUsage()

void simpleUsage ( )
inlineprivate
Test:
demonstrate simple worker pool usage

Definition at line 137 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_pullWork()

void verify_pullWork ( )
inlineprivate
Test:
the given work-functor is invoked repeatedly, once activated.

Definition at line 155 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_workerHalt()

void verify_workerHalt ( )
inlineprivate
Test:
can cause a worker to terminate by return-value from the work-functor

Definition at line 187 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_workerSleep()

void verify_workerSleep ( )
inlineprivate
Test:
a worker can be sent to sleep, throttling the poll frequency.

Definition at line 212 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_workerRetard()

void verify_workerRetard ( )
inlineprivate
Test:
a worker can be retarded and throttled in case of contention.

Definition at line 235 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_workerDismiss()

void verify_workerDismiss ( )
inlineprivate
Test:
when a worker is sent into sleep-cycles for an extended time, the worker terminates itself.

Definition at line 261 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_finalHook()

void verify_finalHook ( )
inlineprivate
Test:
verify invocation of a thread-termination callback

Definition at line 286 of file work-force-test.cpp.

References Config::COMPUTATION_CAPACITY, and vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_detectError()

void verify_detectError ( )
inlineprivate
Test:
exceptions emanating from within the worker are catched and reported by setting the isFailure argument flag of the finalHook functor invoked at worker termination.

Definition at line 313 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_defaultPool()

void verify_defaultPool ( )
inlineprivate
Test:
by default, the WorkForce is initially inactive; once activated, it scales up to the number of cores reported by the runtime system.

Definition at line 351 of file work-force-test.cpp.

References Config::COMPUTATION_CAPACITY, and vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_scalePool()

void verify_scalePool ( )
inlineprivate
Test:
the number of (separate) workers can be scaled up, both stepwise and as fraction of full hardware concurrency

helper to count distinct thread-IDs

Definition at line 374 of file work-force-test.cpp.

References Config::COMPUTATION_CAPACITY, and vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_countActive()

void verify_countActive ( )
inlineprivate
Test:
dynamically determine count of currently active workers.

Definition at line 446 of file work-force-test.cpp.

References vault::gear::test::anonymous_namespace{work-force-test.cpp}::setup().

+ Here is the call graph for this function:

◆ verify_dtor_blocks()

void verify_dtor_blocks ( )
inlineprivate
Test:
verify that the WorkForce dtor waits for all active threads to disappear
  • use a work-functor which keeps all workers blocked
  • start the WorkForce within a separate thread
  • in this separate thread, cause the WorkForce destructor to be called
  • in the test main thread release the work-functor blocking
  • at this point, all workers return, detect shutdown and terminate

Definition at line 482 of file work-force-test.cpp.

+ Inheritance diagram for WorkForce_test:
+ Collaboration diagram for WorkForce_test:

The documentation for this class was generated from the following file: