diff --git a/src/vault/gear/scheduler-commutator.hpp b/src/vault/gear/scheduler-commutator.hpp index 28bd0a836..73a2ea3c8 100644 --- a/src/vault/gear/scheduler-commutator.hpp +++ b/src/vault/gear/scheduler-commutator.hpp @@ -142,6 +142,7 @@ namespace gear { } + /** look into the queues and possibly retrieve work due by now */ Activity* findWork (SchedulerInvocation& layer1, Time now) { @@ -156,10 +157,31 @@ namespace gear { } - + /***************************************************//** + * This is the primary entrance point to the Scheduler. + * Engage into activity as controlled by given start time. + * Attempts to acquire the GroomingToken if Activity is due + * immediately, otherwise just enqueue it for prioritisation. + * @param chain the Render Activities to put into action + * @param when the indicated time of start for these + * @param executionCtx abstracted execution environment for + * Render Activities (typically backed by the + * Scheduler as a whole, including notifications + * @return Status value to indicate how to proceed processing + * - activity::PASS continue processing in regular operation + * - activity::WAIT nothing to do now, check back later + * - activity::HALT serious problem, cease processing + * @note Attempts to acquire the GroomingToken for immediate + * processing, but not for just enqueuing planned tasks. + * Never drops the GroomingToken explicitly (unless when + * switching from grooming-mode to work-mode in the course + * of processing the given Activity chain regularly). + */ template activity::Proc - postDispatch (Activity* chain, EXE& executionCtx) + postDispatch (Activity* chain, Time when + ,EXE& executionCtx + ,SchedulerInvocation& layer1) { UNIMPLEMENTED ("core function: maybe perform activity"); } diff --git a/tests/vault/gear/activity-detector-test.cpp b/tests/vault/gear/activity-detector-test.cpp index 8160216b8..4d9a68faa 100644 --- a/tests/vault/gear/activity-detector-test.cpp +++ b/tests/vault/gear/activity-detector-test.cpp @@ -64,7 +64,7 @@ namespace test { verifyFakeInvocation(); verifyMockJobFunctor(); verifyFakeExeContext(); - watch_activation(); + watch_ActivationProbe(); watch_ActivationTap(); insert_ActivationTap(); watch_notification(); @@ -207,7 +207,7 @@ namespace test { /** @test faked execution context to perform Activity activation * - wired internally to report each invocation into the EventLog * - by default response of `post` and `tick` is `PASS`, but can be reconfigured - * - invocation sequence can be verified by the usual scheme + * - invocation sequence can be verified by matching internally logged events */ void verifyFakeExeContext() @@ -252,11 +252,10 @@ namespace test { - /** @test diagnostic setup to detect Activity activation - * @todo WIP 8/23 ✔ define ✔ implement + /** @test a rigged diagnostic probe to detect Activity activation */ void - watch_activation() + watch_ActivationProbe() { ActivityDetector detector; auto someID = "trap-" + randStr(4); @@ -272,7 +271,6 @@ namespace test { /** @test diagnostic adaptor to detect and pass-through Activity activation - * @todo WIP 8/23 ✔ define ✔ implement */ void watch_ActivationTap() @@ -314,7 +312,6 @@ namespace test { /** @test inject (prepend) an ActivationTap into existing wiring - * @todo WIP 8/23 ✔ define ✔ implement */ void insert_ActivationTap() @@ -343,7 +340,7 @@ namespace test { - /** @test diagnostic setup to detect passing a notification + /** @test diagnostic setup to detect and watch passing a notification * - setup a chain-Activity (here: a `TICK`) protected by a `GATE` * - configure the `GATE` to require one notification * - connect a `NOTIFY`-Activity to trigger the `GATE` @@ -351,8 +348,7 @@ namespace test { * - dispatch of the notification can be verified * - notification has been passed through the Tap to the `GATE` * - `GATE` has been decremented to zero and triggers chain - * - finally the chained `TICK`-Activity calls into the `executionCtx` - * @todo WIP 8/23 ✔ define 🔁 implement + * - finally the chained `TICK`-Activity calls into the `executionCtx` */ void watch_notification() @@ -385,7 +381,6 @@ namespace test { * Activity after the Gate is activated * - for this unit-test, a Gate and a follow-up Activity * is invoked directly, to verify the generated log entries - * @todo WIP 7/23 ✔ define ✔ implement */ void watch_gate() diff --git a/tests/vault/gear/scheduler-commutator-test.cpp b/tests/vault/gear/scheduler-commutator-test.cpp index 8bff31bbe..cd61e2b15 100644 --- a/tests/vault/gear/scheduler-commutator-test.cpp +++ b/tests/vault/gear/scheduler-commutator-test.cpp @@ -118,7 +118,7 @@ namespace test { ActivityDetector detector; // sched.postDispatch (sched.findWork(queues), detector.executionCtx); ///////////////////////OOO findWork umschreiben - cout << detector.showLog()< - - - +

wenn es zur Ausführung kommt: when ≡ now @@ -81632,9 +81630,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

...für den internen Memory-Pool. Der kann zwar wachsen (was dann aber ggfs. blockt). Und: der Pool schrumpft nie! @@ -81710,9 +81706,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

...man könnte ja auf die Idee kommen, daß sich der Scheduler diese Zeit aus dem Activity-Record holt; das wäre aber eine extrem schlechte Idee, denn es würde die ganze Einteilung in Schichten hintertreiben. @@ -81773,9 +81767,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

wird das hier auf Layer-1 realisiert — @@ -81788,9 +81780,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

single level of abstraction / do only one thing and do it well @@ -81815,9 +81805,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

...es handelt sich offensichtlich bei Layer-1 um eine low-Level-Einrichtung und um ein internes API, das nicht gegen Mißbrauch gewappnet sein muß @@ -84910,6 +84898,31 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + +

+ per Seiteneffekt erlangt +

+

+ per Prozeß freigegeben +

+ +
+ + +
+ @@ -85003,9 +85016,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

...sie ist entstanden aus den ersten Analysen, als die Bedeutung der »Activity-Language« noch nicht geklärt war @@ -85027,9 +85038,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

wir sind hier in einer performance-kritischen Zone; insofern kein std::optional<Activity&> @@ -85041,9 +85050,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

man könnte es hier auch freigeben; das würde dann aber im Regelfall ein weiteres mal geprüft und freigegeben; zudem haben wir hier auf dieser Ebene auch kein try-catch @@ -85100,6 +85107,68 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + +

+ Das bedeutet: der Rückgabewert ist ein Kompromiß, und so gestaltet, daß er in beiden Nutz-Szenarien kein Fehlverhalten verursacht. Er ist damit keine Ausführungs-Steuerung, aber signalisiert Fehlersituationen +

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

+ activity::PASS ≡ alles gut … weitermachen +

+ +
+
+ + + + +

+ activity::WAIT ≡  … aktuell nichts mehr zu tun +

+ +
+
+ + + + +

+ activity::HALT ≡ oh weh … bitte anhalten +

+ +
+
+
@@ -85139,44 +85208,35 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

versuche GroomingToken zu erlangen (Seiteneffekt)

- -
+
- - - +

...weil im normalen Control-flow direkt danach die Activity in die Queue gestellt wird — und da können wir eine signifikannte Beschleunigung erziehlen wenn wir das GroomingToken halten und deshalb nicht durch die Instruct-Queue gehen müssen

- -
+
- - - +

...und zwar, weil sie infolge der hier getroffenen Entscheidung unmittelbar in den Dispatch gehen können; wäre das nicht so, dann würde u.U aus der Priority-Queue zunächst eine noch dringendere/frühere Aufgabe entnommen werden.

- -
+
@@ -86149,9 +86209,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

offen: wie erfolgt hier der »Seed« ? @@ -86161,9 +86219,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

typischerweise ist das eine Planungs-Activity, also ein activity::Term::META_JOB @@ -86180,9 +86236,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

...und würde dadurch dann nach dem Meta-Job auch gleich noch den ersten Frame-Job ausführen, was aber genau so auch wünschenswert ist @@ -86192,9 +86246,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

...was schlimmstenfalls dazu führt, daß er direkt den ersten Planungs-Chunk ausführt @@ -86245,9 +86297,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - +

  • @@ -86258,8 +86308,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- -
+
@@ -86295,9 +86344,29 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + + + + + + + + + + + + + + + + + + + +