From 2e6712e8163008e71d728443d402aa446bb96be8 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 4 Dec 2023 03:57:04 +0100 Subject: [PATCH] Chain-Load: implement invocation through JobFunctor - use a ''special encoding'' to marshal the specific coordinates for this test setup - use a fixed Frame-Grid to represent the ''time level'' - invoke hash calculation through a specialised JobFunctor subclass --- tests/vault/gear/test-chain-load-test.cpp | 13 ++++-- tests/vault/gear/test-chain-load.hpp | 38 +++++++++++++++-- wiki/thinkPad.ichthyo.mm | 50 ++++++++++++++++++++--- 3 files changed, 89 insertions(+), 12 deletions(-) diff --git a/tests/vault/gear/test-chain-load-test.cpp b/tests/vault/gear/test-chain-load-test.cpp index 0975694f0..caf785e78 100644 --- a/tests/vault/gear/test-chain-load-test.cpp +++ b/tests/vault/gear/test-chain-load-test.cpp @@ -930,8 +930,7 @@ namespace test { /** @test TODO setup for running a chain-load as scheduled task * - running an isolated Node recalculation * - dispatch of this recalculation packaged as render job - * - * @todo WIP 12/23 πŸ” define ⟢ implement + * @todo WIP 12/23 πŸ” define ⟢ πŸ” implement */ void verify_scheduling_setup() @@ -975,10 +974,18 @@ namespace test { CHECK (e.hash == 0); job0.triggerJob(); + // ◁───────────────────────────────────────────── Note: fail to invoke some predecessor.... job2.triggerJob(); - job1.triggerJob(); + job3.triggerJob(); + CHECK (e.hash != 0x6A5924BA3389D7C); + + e.hash = 0; + job1.triggerJob(); // recalculate missing part of the graph... job3.triggerJob(); CHECK (e.hash == 0x6A5924BA3389D7C); + + job3.triggerJob(); // Hash calculations are *not* idempotent + CHECK (e.hash != 0x6A5924BA3389D7C); } }; diff --git a/tests/vault/gear/test-chain-load.hpp b/tests/vault/gear/test-chain-load.hpp index 6d4097f47..056605de2 100644 --- a/tests/vault/gear/test-chain-load.hpp +++ b/tests/vault/gear/test-chain-load.hpp @@ -117,6 +117,7 @@ namespace test { // using std::function; // using lib::time::TimeValue; using lib::time::Time; + using lib::time::FrameRate; // using lib::time::FSecs; // using lib::time::Offset; // using lib::meta::RebindVariadic; @@ -1014,8 +1015,18 @@ namespace test { { using Node = typename TestChainLoad::Node; + Node* startNode_; + + static lib::time::Grid& + testGrid() ///< Meyer's Singleton : a fixed 1fps quantiser + { + static lib::time::FixedFrameQuantiser gridOne{FrameRate::STEP}; + return gridOne; + } + public: RandomChainCalcFunctor(Node& startNode) + : startNode_{&startNode} { } @@ -1024,19 +1035,26 @@ namespace test { void invokeJobOperation (JobParameter param) override { - UNIMPLEMENTED ("unpack parameters and dispatch into TestChainLoad-Node"); + size_t nodeIdx = decodeNodeID (param.invoKey); + size_t level = decodeLevel (TimeValue{param.nominalTime}); + Node& target = startNode_[nodeIdx]; + ASSERT (target.level == level); + // invoke the Β»media calculationΒ« + target.calculate(); } string diagnostic() const override { - return "ChainCalc-TODoh"; + return _Fmt{"ChainCalc(w:%d)β–Ά%s"} + % maxFan + % util::showAddr(startNode_); } /** package the node-index to invoke. * @note per convention for this test, this info will be * packaged into the lower word of the InvocationInstanceID */ - static auto + static InvocationInstanceID encodeNodeID (size_t idx) { InvocationInstanceID invoKey; @@ -1044,10 +1062,22 @@ namespace test { return invoKey; }; + static size_t + decodeNodeID (InvocationInstanceID invoKey) + { + return size_t(invoKey.code.w1); + }; + static Time encodeLevel (size_t level) { - UNIMPLEMENTED ("setup a FixedFrameQuantiser with 1FPS"); + return Time{testGrid().timeOf (FrameCnt(level))}; + } + + static size_t + decodeLevel (TimeValue nominalTime) + { + return testGrid().gridPoint (nominalTime); } }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 966c40164..60ea2d71a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -96465,6 +96465,18 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + @@ -100440,7 +100452,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + + @@ -100597,7 +100611,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + @@ -100808,12 +100823,37 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + -
- + + - + + + + + + + + + + + + + + + + + + + + + + + +