diff --git a/src/vault/gear/load-controller.hpp b/src/vault/gear/load-controller.hpp index 8ffe680d5..3e297edbc 100644 --- a/src/vault/gear/load-controller.hpp +++ b/src/vault/gear/load-controller.hpp @@ -78,13 +78,14 @@ #include "lib/error.hpp" //#include "vault/gear/block-flow.hpp" -#include "vault/gear/activity-lang.hpp" +//#include "vault/gear/activity-lang.hpp" //#include "lib/symbol.hpp" #include "lib/nocopy.hpp" //#include "lib/util.hpp" //#include #include +#include namespace vault{ @@ -96,8 +97,9 @@ namespace gear { using lib::time::Time; using lib::time::FSecs; using lib::time::TimeVar; - using lib::time::Offset; + using lib::time::TimeValue; using lib::time::Duration; + using lib::time::Offset; using std::chrono_literals::operator ""ms; using std::chrono_literals::operator ""us; @@ -125,16 +127,26 @@ namespace gear { class LoadController : util::NonCopyable { - BlockFlowAlloc& allocator_; - - TimeVar tendedHead_{Time::ANYTIME}; - public: + struct Wiring + { + size_t maxCapacity{2}; + }; + explicit - LoadController (BlockFlowAlloc& blockFlow) - : allocator_{blockFlow} + LoadController (Wiring&& wiring) + : wiring_{std::move (wiring)} { } + LoadController() + : LoadController{Wiring{}} + { } + + private: + Wiring wiring_; + + TimeVar tendedHead_{Time::ANYTIME}; + public: /** * did we already tend for the indicated next head time? diff --git a/src/vault/gear/scheduler.hpp b/src/vault/gear/scheduler.hpp index cadc0d097..bbbf7b031 100644 --- a/src/vault/gear/scheduler.hpp +++ b/src/vault/gear/scheduler.hpp @@ -113,7 +113,7 @@ namespace gear { , layer2_{} , workForce_{Setup{IDLE_WAIT, DISMISS_CYCLES, *this}} , activityLang_{activityAllocator} - , loadControl_{activityAllocator} + , loadControl_{connectMonitoring()} , engineObserver_{engineObserver} { } @@ -219,6 +219,16 @@ namespace gear { } }; + + /** @internal connect state signals for use by the LoadController */ + LoadController::Wiring + connectMonitoring() + { + LoadController::Wiring setup; + setup.maxCapacity = work::Config::COMPUTATION_CAPACITY; + return setup; + } + /** @internal expose a binding for Activity execution */ class ExecutionCtx; }; diff --git a/tests/vault/gear/scheduler-load-control-test.cpp b/tests/vault/gear/scheduler-load-control-test.cpp index 6d55860e3..826d128c6 100644 --- a/tests/vault/gear/scheduler-load-control-test.cpp +++ b/tests/vault/gear/scheduler-load-control-test.cpp @@ -78,8 +78,7 @@ namespace test { void simpleUsage() { - BlockFlowAlloc bFlow; - LoadController ctrl{bFlow}; + LoadController ctrl; } @@ -126,8 +125,7 @@ namespace test { void tendNextActivity() { - BlockFlowAlloc bFlow; - LoadController lctrl{bFlow}; + LoadController lctrl; Time t1{1,0}; Time t2{2,0}; @@ -172,8 +170,7 @@ namespace test { void classifyCapacity() { - BlockFlowAlloc bFlow; - LoadController lctrl{bFlow}; + LoadController lctrl; Time next{0,10}; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 734e02bd1..f1b8e3b3c 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -81973,6 +81973,36 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + +

+ ...unterscheiden sich doch im Detail +

+
    +
  • + einmal ist es der Scheduler selber, dessen Funktionalität abstrahiert als ExecutionCtx bereitzustellen ist +
  • +
  • + die WorkForce hingegen ist konzeptionell selbständig, wird aber vom Scheduler übernommen und gezielt parametrisiert, einschließlich der Abstraktion doWork(), welche dann doch vom Scheduler selbst zustammengestellt wird +
  • +
  • + nochmal anders ist die Situation beim LoadController, der so etwas wie die Steuerzentrale darstellt: konzeptionell ist er total vom Scheduler abhängig, aber seine Implementierung ist entkoppelt,  wiewohl in beide Richtungen verdrahtet mit wechselseitiger Abhängigkeit. In diesem Fall muß also ein Abhängigkeitszyklus durchbrochen werden +
  • +
+ +
+
+
@@ -82227,6 +82257,84 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+ hier könnte man named arguments gebrauchen.... +

+ +
+ + +
+ + + + + + +

+ Parametrisierung: maxCapacity = work::Config::COMPUTATION_CAPACITY +

+ + +
+
+ + + + + + + + + + + + +

+ schwierige Frage.... +

+
    +
  • + man würde eine subtile Falle vermeiden +
  • +
  • + man würde point-and-shot-API bekommen +
  • +
  • + aber eben auch eine ganz starke Kopplung auf Implementierungsdetails +
  • +
+ +
+
+
+
+
@@ -95736,6 +95844,24 @@ class Something
+ + + + + + + + + + + + + + + + + +