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

Description

Test:
Scheduler Layer-2: coordination of Activity execution.
Remarks
Layer-2 combines the queue data structure from Layer-1 with the »Activity Language« to allow performing of Render Activities. This test verifies the proper integration of these building blocks
  • the Grooming-Token is an atomic lock tied to current thread-id; it will be acquired for all operations manipulating internal state
  • the ActivityDetector is used as a test helper to record calls and to verify the Activities are indeed activated as expected
  • the integratedWorkCycle() walks through all the steps typically happening when a Render-Job is first planned and scheduled, and then retrieved and executed by the WorkForce. However, these steps are invoked directly here, and with suitable instrumentation to watch processing in detail
  • the complete Scheduler functionality is assembled one level higher in the Scheduler-Service...
See also
SchedulerActivity_test
ActivityDetector_test
SchedulerUsage_test

Definition at line 90 of file scheduler-commutator-test.cpp.

Private Types

using Launch = ThreadHookable::Launch
 

Private Member Functions

void blockGroomingToken (SchedulerCommutator &sched)
 
void demonstrateSimpleUsage ()
 
void integratedWorkCycle ()
 
virtual void run (Arg)
 
void torture_GroomingToken ()
 
void unblockGroomingToken ()
 
void verify_dispatch ()
 
void verify_findWork ()
 
void verify_GroomingGuard ()
 
void verify_GroomingToken ()
 
void verify_postChain ()
 
void verify_Significance ()
 

Static Private Member Functions

static void ___ensureGroomingTokenReleased (SchedulerCommutator &sched)
 

Private Attributes

unique_ptr< ThreadHookablegroomingHog_
 
atomic_bool stopTheHog_ {false}
 

Additional Inherited Members

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

Member Function Documentation

◆ demonstrateSimpleUsage()

void demonstrateSimpleUsage ( )
inlineprivate
Test:
demonstrate a simple usage scenario

Definition at line 111 of file scheduler-commutator-test.cpp.

References ActivityMatch::arg(), ActivityLang::dispatchChain(), SchedulerCommutator::findWork(), and SchedulerInvocation::instruct().

+ Here is the call graph for this function:

◆ verify_GroomingToken()

void verify_GroomingToken ( )
inlineprivate
Test:
verify logic to control concurrent execution

Definition at line 142 of file scheduler-commutator-test.cpp.

References SchedulerCommutator_test::___ensureGroomingTokenReleased(), SchedulerCommutator::acquireGoomingToken(), SchedulerCommutator::dropGroomingToken(), and SchedulerCommutator::holdsGroomingToken().

+ Here is the call graph for this function:

◆ ___ensureGroomingTokenReleased()

static void ___ensureGroomingTokenReleased ( SchedulerCommutator sched)
inlinestaticprivate

helper to ensure consistent Grooming-Token state

Definition at line 159 of file scheduler-commutator-test.cpp.

References SchedulerCommutator::acquireGoomingToken(), SchedulerCommutator::dropGroomingToken(), and SchedulerCommutator::holdsGroomingToken().

Referenced by SchedulerCommutator_test::integratedWorkCycle(), SchedulerCommutator_test::verify_GroomingGuard(), SchedulerCommutator_test::verify_GroomingToken(), and SchedulerCommutator_test::verify_postChain().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verify_GroomingGuard()

void verify_GroomingGuard ( )
inlineprivate
Test:
verify extended logic to protect a scope
  • if the thread already holds the grooming token, nothing happens
  • otherwise, it is acquired (blocking) and dropped on exit

Definition at line 174 of file scheduler-commutator-test.cpp.

References SchedulerCommutator_test::___ensureGroomingTokenReleased(), SchedulerCommutator::acquireGoomingToken(), SchedulerCommutator::dropGroomingToken(), SchedulerCommutator::holdsGroomingToken(), SchedulerCommutator::requireGroomingTokenHere(), and vault::gear::anonymous_namespace{scheduler-commutator.hpp}::thisThread().

+ Here is the call graph for this function:

◆ torture_GroomingToken()

void torture_GroomingToken ( )
inlineprivate
Test:
ensure the GroomingToken mechanism indeed creates mutual exclusion to protected against concurrent corruption.
Remarks
uses lib::test::threadBenchmark() to put the test-subject under pressure by strongly contended parallel execution.

Definition at line 207 of file scheduler-commutator-test.cpp.

References SchedulerCommutator::acquireGoomingToken(), and SchedulerCommutator::dropGroomingToken().

+ Here is the call graph for this function:

◆ blockGroomingToken()

void blockGroomingToken ( SchedulerCommutator sched)
inlineprivate

Helper to block the GroomingToken from another thread

Definition at line 248 of file scheduler-commutator-test.cpp.

References SchedulerCommutator::acquireGoomingToken(), ThreadWrapper::detach_thread_from_wrapper(), SchedulerCommutator::dropGroomingToken(), and SchedulerCommutator::holdsGroomingToken().

Referenced by SchedulerCommutator_test::verify_dispatch(), SchedulerCommutator_test::verify_findWork(), and SchedulerCommutator_test::verify_postChain().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unblockGroomingToken()

void unblockGroomingToken ( )
inlineprivate

stop the background thread to unblock the GrooingToken

Definition at line 274 of file scheduler-commutator-test.cpp.

Referenced by SchedulerCommutator_test::verify_dispatch(), SchedulerCommutator_test::verify_findWork(), and SchedulerCommutator_test::verify_postChain().

+ Here is the caller graph for this function:

◆ verify_findWork()

void verify_findWork ( )
inlineprivate
Test:
verify the logic to decide where and when to perform the dispatch of a Scheduler Activity chain.
Test:
verify logic of queue updates and work prioritisation.

Definition at line 336 of file scheduler-commutator-test.cpp.

References SchedulerCommutator_test::blockGroomingToken(), SchedulerCommutator::findWork(), SchedulerInvocation::headTime(), SchedulerInvocation::instruct(), and SchedulerCommutator_test::unblockGroomingToken().

+ Here is the call graph for this function:

◆ verify_Significance()

void verify_Significance ( )
inlineprivate
Test:
verify that obsoleted or rejected entries are dropped transparently
  • add entries providing extra information regarding significance
  • verify that missing the deadline is detected
  • entries past deadline will be dropped when pulling for work
  • entries tagged with an ManifestationID can be disabled and will be automatically disposed.
  • an entry marked as compulsory will block that process when missing it's deadline

Definition at line 400 of file scheduler-commutator-test.cpp.

References SchedulerInvocation::activate(), SchedulerInvocation::feedPrioritisation(), SchedulerCommutator::findWork(), SchedulerInvocation::headTime(), SchedulerInvocation::instruct(), SchedulerInvocation::isMissed(), SchedulerInvocation::isOutdated(), SchedulerInvocation::isOutOfTime(), and SchedulerInvocation::peekHead().

+ Here is the call graph for this function:

◆ verify_postChain()

◆ verify_dispatch()

void verify_dispatch ( )
inlineprivate
Test:
verify basic functionality to dequeue and dispatch entries.
Remarks
this is actually the core of the »work-function«, and can not easily be demonstrated on a unit-test level, due to the interplay with timing and load distribution. So this test is limited to show that an entry passes through the queues and is dispatched
See also
SchedulerService_test::invokeWorkFunction() for a more comprehensive integration test

Definition at line 553 of file scheduler-commutator-test.cpp.

References SchedulerCommutator_test::blockGroomingToken(), ActivityDetector::buildActivationProbe(), SchedulerCommutator::dispatchCapacity(), ActivityLang::dispatchChain(), SchedulerInvocation::feedPrioritisation(), SchedulerInvocation::headTime(), SchedulerCommutator::holdsGroomingToken(), SchedulerInvocation::instruct(), Time::NEVER, and SchedulerCommutator_test::unblockGroomingToken().

+ Here is the call graph for this function:

◆ integratedWorkCycle()

void integratedWorkCycle ( )
inlineprivate
Test:
step-wise perform the typical sequence of planning and worker activation
  • use the Render-Job scenario from SchedulerActivity_test::scenario_RenderJob()
  • use similar instrumentation to trace Activities
  • specifically rig the diagnostic executionCtx to drop the GroomingToken at λ-work
  • Step-1 : schedule the Activity-term
  • Step-2 : later search for work, retrieve and dispatch the term
  • verify the expected sequence of Activities actually occurred
See also
ActivityLang::buildCalculationJob()
ActivityDetector::buildMockJob()

Definition at line 621 of file scheduler-commutator-test.cpp.

References SchedulerCommutator_test::___ensureGroomingTokenReleased(), ActivityMatch::arg(), ActivityLang::dispatchChain(), SchedulerCommutator::dropGroomingToken(), SchedulerCommutator::findWork(), SchedulerCommutator::holdsGroomingToken(), ActivityDetector::incrementSeq(), Activity::next, and SchedulerCommutator::postChain().

+ Here is the call graph for this function:
+ Inheritance diagram for SchedulerCommutator_test:
+ Collaboration diagram for SchedulerCommutator_test:

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