diff --git a/src/vault/gear/activity.hpp b/src/vault/gear/activity.hpp index df1d8c130..a9f440490 100644 --- a/src/vault/gear/activity.hpp +++ b/src/vault/gear/activity.hpp @@ -61,17 +61,27 @@ namespace gear { /** - * Basic (abstracted) view of... - * - * @see SomeSystem - * @see NA_test + * Term to describe an Activity, + * to happen within the Scheduler's control flow. */ class Activity { public: -// explicit - Activity () + enum Verb {INVOKE ///< dispatches a JobFunctor into a worker thread + ,DEPEND ///< verify a given number of dependencies has been satisfied + ,TIMESTART ///< signal start of some processing (for timing measurement) + ,TIMESTOP ///< correspondingly signal end of some processing + ,NOTIFY ///< push a message to another Activity + ,PROBE ///< evaluate a condition and inhibit another target Activity + ,TICK ///< internal engine »heart beat« for internal maintenance hook(s) + }; + + const Verb verb_; + + explicit + Activity (Verb verb) + : verb_{verb} { } // using default copy/assignment diff --git a/src/vault/gear/scheduler-control.hpp b/src/vault/gear/scheduler-control.hpp index db0714ef0..bc7bd807b 100644 --- a/src/vault/gear/scheduler-control.hpp +++ b/src/vault/gear/scheduler-control.hpp @@ -63,8 +63,8 @@ namespace gear { { public: - explicit - SchedulerControl (int const& b) +// explicit + SchedulerControl() { } }; diff --git a/src/vault/gear/scheduler-invocation.hpp b/src/vault/gear/scheduler-invocation.hpp index fb8b61d2b..8ffedf2e5 100644 --- a/src/vault/gear/scheduler-invocation.hpp +++ b/src/vault/gear/scheduler-invocation.hpp @@ -47,13 +47,17 @@ //#include #include #include +#include namespace vault{ namespace gear { + namespace error = lumiera::error; // using util::isnil; // using std::string; + using std::move; + /** * Scheduler Layer-2 : invocation. @@ -68,6 +72,16 @@ namespace gear { { size_t waterlevel{0}; Activity* activity{nullptr}; + + /** @internal ordering function for time based scheduling + * @note reversed order as required by std::priority_queue + * to get the earliest element at top of the queue + */ + bool + operator< (ActOrder const& o) const + { + return waterlevel > o.waterlevel; + } }; using InstructQueue = boost::lockfree::queue; @@ -77,10 +91,49 @@ namespace gear { PriorityQueue priority_; public: - explicit - SchedulerInvocation (int const& moo) +// explicit + SchedulerInvocation() { } + + /** + * Accept an Activity for time-bound execution + */ + void + instruct (Activity& activity) + { + size_t waterLevel = 123; /////////////////////////////////////////////////////OOO derive water level from time window + bool success = instruct_.push (ActOrder{waterLevel, &activity}); + if (not success) + throw error::Fatal{"Scheduler entrance: memory allocation failed"}; + } + + + /** + * Pick up a new Activity and enqueue it according to time order + */ + void + prioriseNext() + { + ActOrder actOrder; + bool hasInput = instruct_.pop (actOrder); + if (not hasInput) + return; + priority_.push (move (actOrder)); + } + + + /** + * If there is an Activity to process now, pick it from the scheduling queue + */ + Activity& + acceptHead() + { + Activity* activity = priority_.top().activity; + ///////////////////////////////////////////////////////////////////////////////OOO need to handle an empty queue or an Activity not ready to schedule yet + priority_.pop(); + return *activity; + } }; diff --git a/src/vault/gear/scheduler.hpp b/src/vault/gear/scheduler.hpp index b12fbacd4..db53d62d3 100644 --- a/src/vault/gear/scheduler.hpp +++ b/src/vault/gear/scheduler.hpp @@ -66,12 +66,14 @@ namespace gear { */ class Scheduler { - int nothing_; + SchedulerInvocation layer1_; + SchedulerControl layer2_; public: explicit - Scheduler (int const& boo) - : nothing_(boo) + Scheduler() + : layer1_{} + , layer2_{} { } // using default copy/assignment diff --git a/wiki/renderengine.html b/wiki/renderengine.html index 596390c6d..9d4841b89 100644 --- a/wiki/renderengine.html +++ b/wiki/renderengine.html @@ -6843,7 +6843,7 @@ At first sight the link between asset and clip-MO is a simple logical relation b {{red{Note 1/2015}}} several aspects regarding the relation of clips and single/multichannel media are not yet settled. There is a preliminary implementation in the code base, but it is not sure yet how multichnnel media will actually be modelled. Currently, we tend to treat the channel multiplicity rather as a property of the involved media, i.e we have //one// clip object. -
+
//Render Activities define the execution language of the render engine.//
 The [[Scheduler]] maintains the ability to perform these Activities, in a time-bound fashion, observing dependency relations; activities allow for notification of completed work, tracking of dependencies, timing measurements, re-scheduling of other activities -- and last but not least the dispatch of actual [[render jobs|RenderJob]]. Activities are what is actually enqueued with priority in the scheduler implementation, they are planned for a »µ-tick slot«, activated once when the activation time is reached, and then forgotten. Each Activity is a //verb//, but can be inhibited by conditions and carry operation object data. Formally, activating an Activity equates to a predication, and the subject of that utterance is »the render process«.
 
@@ -6853,13 +6853,13 @@ The [[Scheduler]] maintains the ability to perform these Activities, in a time-b
 :no further dependency checks; Activities attached to the job are re-dispatched after the job function's completion
 ;depend
 :verify a given number of dependencies has been satisfied, otherwise inhibit the indicated target Activity
-;starttime
+;timestart
 :signal start of some processing -- for the purpose of timing measurement, but also to detect crashed tasks
-;stoptime
+;timestop
 :correspondingly signal end of some processing
 ;notify
 :push a message to another Activity or process record
-;check
+;probe
 :invoke a closure within engine context; inhibit another target Activity, depending on the result.
 ;tick
 :internal engine »heart beat« -- invoke internal maintenance hook(s)
diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm
index 305f43883..c6297830a 100644
--- a/wiki/thinkPad.ichthyo.mm
+++ b/wiki/thinkPad.ichthyo.mm
@@ -77773,7 +77773,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -77785,7 +77785,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -77809,7 +77809,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -77935,7 +77935,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + @@ -77965,6 +77966,42 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -78664,7 +78701,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -78675,8 +78712,22 @@ Date:   Thu Apr 20 18:53:17 2023 +0200

- + + + + + + + + + +

+ is ja eine linked List +

+ +
+
@@ -78696,7 +78747,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + +