diff --git a/src/vault/gear/block-flow.hpp b/src/vault/gear/block-flow.hpp index 7f405c645..726d9de79 100644 --- a/src/vault/gear/block-flow.hpp +++ b/src/vault/gear/block-flow.hpp @@ -225,9 +225,45 @@ namespace gear { { UNIMPLEMENTED ("traverse oldest Epochs and discard obsoleted"); } + + private: + /////////////////// + + /// „backdoor“ to watch internals from tests + friend class FlowDiagnostic; }; + + + + + + /* ===== Test / Diagnostic ===== */ + + class FlowDiagnostic + { + BlockFlow& flow_; + + public: + FlowDiagnostic(BlockFlow& theFlow) + : flow_{theFlow} + { } + +// size_t first() { return exFam_.start_; } +// size_t last() { return exFam_.after_; } + size_t cntEpochs() { return watch(flow_.alloc_).active(); } + size_t poolSize() { return watch(flow_.alloc_).size(); } + }; + + inline FlowDiagnostic + watch (BlockFlow& theFlow) + { + return FlowDiagnostic{theFlow}; + } + + + }} // namespace vault::gear #endif /*SRC_VAULT_GEAR_BLOCK_FLOW_H_*/ diff --git a/tests/32scheduler.tests b/tests/32scheduler.tests index adc7af79b..beae46256 100644 --- a/tests/32scheduler.tests +++ b/tests/32scheduler.tests @@ -2,6 +2,12 @@ TESTING "Component Test Suite: Scheduler" ./test-suite --group=engine +PLANNED "Activity observation framework" ActivityDetector_test < + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + +/** @file activity-detector-test.cpp + ** unit test \ref ActivityDetector_test + */ + + +#include "lib/test/run.hpp" +#include "activity-detector.hpp" +//#include "lib/time/timevalue.hpp" +//#include "lib/format-cout.hpp" +//#include "lib/util.hpp" + +//#include + +//using test::Test; +//using lib::time::Time; +//using lib::time::FSecs; +//using std::move; +//using util::isSameObject; + + +namespace vault{ +namespace gear { +namespace test { + +// using lib::time::FrameRate; +// using lib::time::Offset; +// using lib::time::Time; + + + + + + /*****************************************************************//** + * @test verify instrumentation setup to watch scheduler Activities. + * @see SchedulerActivity_test + * @see SchedulerUsage_test + */ + class ActivityDetector_test : public Test + { + + virtual void + run (Arg) + { + simpleUsage(); + + verifyDummyFuncttor(); + detect_activation(); + detect_gate(); + } + + + /** @test TODO demonstrate a simple usage scenario + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + simpleUsage() + { + ActivityDetector spectre; + } + + + + /** @test TODO diagnostic setup to detect a JobFunctor activation + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + verifyDummyFuncttor() + { + } + + + + /** @test TODO diagnostic setup to detect Activity activation and propagation + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + detect_activation() + { + } + + + + /** @test TODO diagnostic setup to watch Activity::GATE activation + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + detect_gate() + { + } + }; + + + /** Register this test class... */ + LAUNCHER (ActivityDetector_test, "unit engine"); + + + +}}} // namespace vault::gear::test diff --git a/tests/vault/gear/activity-detector.hpp b/tests/vault/gear/activity-detector.hpp new file mode 100644 index 000000000..84741cd40 --- /dev/null +++ b/tests/vault/gear/activity-detector.hpp @@ -0,0 +1,109 @@ +/* + ACTIVITY-DETECTOR.hpp - test scaffolding to observe activities within the scheduler + + Copyright (C) Lumiera.org + 2023, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/** @file activity-detector.hpp + ** Diagnostic setup to instrument and observe \ref Activity activations. + ** The [Scheduler](\ref scheduler.hpp) powering the Lumiera render engine + ** is implemented in terms of Activities, which can be time-bound and depend + ** on each other. For performance reasons, these _operational atoms_ must be + ** implemented as a tightly knit network of lightweight POD records without + ** much indirection. This setup poses a challenge for unit tests and similar + ** white box testing, due to the lack of a managed platform and any further + ** means of indirection and extension. As a remedy, a set of preconfigured + ** _detector Activity records_ is provided, which drop off event log messages + ** by side effect. These detector probes can be wired in as decorators into + ** a otherwise valid Activity-Term, allowing to watch and verify patterns + ** of invocation -- which might even happen concurrently. + ** + ** @todo WIP-WIP-WIP 7/2023 right now this is a rather immature attempt + ** towards a scaffolding to propel the build-up of the scheduler. + ** @see SchedulerActivity_test + */ + + +#ifndef VAULT_GEAR_TEST_ACTIVITY_DETECTOR_H +#define VAULT_GEAR_TEST_ACTIVITY_DETECTOR_H + + +#include "vault/common.hpp" +//#include "lib/test/test-helper.hpp" +//#include "steam/play/dummy-play-connection.hpp" +//#include "steam/fixture/node-graph-attachment.hpp" +//#include "steam/fixture/segmentation.hpp" +//#include "steam/mobject/model-port.hpp" +//#include "steam/engine/dispatcher.hpp" +//#include "steam/engine/job-ticket.hpp" +//#include "vault/gear/job.h" +//#include "vault/real-clock.hpp" +//#include "lib/allocator-handle.hpp" +//#include "lib/time/timevalue.hpp" +//#include "lib/diff/gen-node.hpp" +//#include "lib/linked-elements.hpp" +//#include "lib/itertools.hpp" +//#include "lib/depend.hpp" +//#include "lib/util.hpp" + +//#include +//#include + + +namespace vault{ +namespace gear { +namespace test { + +// using std::make_tuple; +// using lib::diff::GenNode; +// using lib::diff::MakeRec; +// using lib::time::TimeValue; +// using lib::time::Time; +// using lib::HashVal; +// using util::isnil; +// using util::isSameObject; +// using fixture::Segmentation; +// using vault::RealClock; +// using vault::gear::Job; +// using vault::gear::JobClosure; + + + + /** + * Diagnostic context to record and evaluate activations within the Scheduler. + * @todo WIP-WIP-WIP 7/23 a new loopy hope + */ + class ActivityDetector + : util::NonCopyable + { + void* zombiePoolFactor_; + + public: + /* == walking deadline implementation == */ + + ActivityDetector() + : zombiePoolFactor_{} + { } + + private: + }; + + +}}} // namespace vault::gear::test +#endif /*VAULT_GEAR_TEST_ACTIVITY_DETECTOR_H*/ diff --git a/tests/vault/gear/block-flow-test.cpp b/tests/vault/gear/block-flow-test.cpp index f73ac460e..d128f7f08 100644 --- a/tests/vault/gear/block-flow-test.cpp +++ b/tests/vault/gear/block-flow-test.cpp @@ -64,19 +64,23 @@ namespace test { run (Arg) { simpleUsage(); - calculateDeadline(); - setupLalup(); + verifyAPI(); + handleEpoch(); + placeActivity(); + adjustEpochs(); + storageFlow(); } /** @test TODO demonstrate a simple usage scenario + * @todo WIP 7/23 ⟶ define ⟶ implement */ void simpleUsage() { BlockFlow bFlow; Time deadline = randTime(); - Activity tick = bFlow.until(deadline).create(); + Activity& tick = bFlow.until(deadline).create(); ///////////////////////////////////////////////////////////////////////////////OOO diagnostic function to check allocation bFlow.discardBefore (deadline + Time{0,5}); @@ -85,19 +89,51 @@ namespace test { - /** @test TODO + /** @test verify the primary BlockFlow API functions in isolation + * @todo WIP 7/23 ⟶ define ⟶ implement */ void - calculateDeadline() + verifyAPI() { } - /** @test TODO + /** @test TODO cover the handling of Epochs + * @todo WIP 7/23 ⟶ define ⟶ implement */ void - setupLalup() + handleEpoch() + { + } + + + + /** @test TODO place Activity record into storage + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + placeActivity() + { + } + + + + /** @test TODO load based regulation of Epoch spacing + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + adjustEpochs() + { + } + + + + /** @test TODO maintain progression of epochs. + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + storageFlow() { } }; diff --git a/tests/vault/gear/scheduler-activity-test.cpp b/tests/vault/gear/scheduler-activity-test.cpp index f20100c0c..dc36046e9 100644 --- a/tests/vault/gear/scheduler-activity-test.cpp +++ b/tests/vault/gear/scheduler-activity-test.cpp @@ -41,7 +41,7 @@ using lib::time::FSecs; namespace vault{ -namespace gear { +namespace gear { namespace test { // using lib::time::FrameRate; @@ -63,13 +63,22 @@ namespace test { virtual void run (Arg) { - simpleUsage(); - walkingDeadline(); - setupLalup(); + simpleUsage(); + + verifyActivity_Invoke(); + verifyActivity_Notify(); + verifyActivity_Gate(); + + termBuilder(); + + scenario_RenderJob(); + scenario_IOJob(); + scenario_MetaJob(); } /** @test TODO demonstrate a simple usage scenario + * @todo WIP 7/23 ⟶ define ⟶ implement */ void simpleUsage() @@ -84,19 +93,71 @@ namespace test { - /** @test TODO + /** @test TODO behaviour of Activity::INVOKE + * @todo WIP 7/23 ⟶ define ⟶ implement */ void - walkingDeadline() + verifyActivity_Invoke() { } - /** @test TODO + /** @test TODO behaviour of Activity::NOTIFY + * @todo WIP 7/23 ⟶ define ⟶ implement */ void - setupLalup() + verifyActivity_Notify() + { + } + + + + /** @test TODO behaviour of Activity::GATE + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + verifyActivity_Gate() + { + } + + + + /** @test TODO verify the Activity term builder + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + termBuilder() + { + } + + + + /** @test TODO usage scenario: Activity graph for a render job + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + scenario_RenderJob() + { + } + + + + /** @test TODO usage scenario: Activity graph for an async Job + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + scenario_IOJob() + { + } + + + + /** @test TODO usage scenario: Activity graph for administrative job + * @todo WIP 7/23 ⟶ define ⟶ implement + */ + void + scenario_MetaJob() { } }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 2755dcea1..2123a56b9 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -78787,9 +78787,84 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -78890,6 +78965,69 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + +

+ ...weil ich damit auch die erweiterten Scheduler-Tests mit abdecken könnte (concurrency)... +

+ +
+ +
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -79193,7 +79331,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -79665,7 +79803,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -79675,6 +79813,37 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + @@ -79768,6 +79937,76 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +