Scheduler-test: refactor and clarify λ-post

In the course of the last refactorings, a slight change in processing
order was introduced, which turned out to improve parallelisation considerably.

- Some further implementation logic can be relegated into the ActivationEvent
- the handling of start times now also incldues a check for sake of symmetry
- document the semantics change: λ-post no longer dispatches directly
This commit is contained in:
Fischlurch 2023-12-19 21:51:33 +01:00
parent f526360319
commit 523586570f
3 changed files with 39 additions and 5 deletions

View file

@ -132,6 +132,14 @@ namespace gear {
Time startTime() const { return Time{TimeValue{starting}};}
Time deathTime() const { return Time{TimeValue{deadline}};}
void
refineTo (Activity* chain, Time when, Time dead)
{
activity = chain;
starting = _raw(activity->constrainedStart (when.isRegular()? when:startTime()));
deadline = _raw(activity->constrainedDeath (dead.isRegular()? dead:deathTime()));
}
};

View file

@ -511,16 +511,16 @@ namespace gear {
* of activations and notifications. The concrete implementation
* needs some further contextual information, which is passed
* down here as a nested sub-context.
* @note different than Scheduler::postChain(), this operation here
* always enqueues the \a chain, never dispatches directly.
* This special twist helps to improve parallelisation.
*/
activity::Proc
post (Time when, Time dead, Activity* chain, ExecutionCtx& ctx)
{
REQUIRE (chain);
ActivationEvent chainEvent = ctx.rootEvent;
chainEvent.activity = chain;
chainEvent.starting = _raw(chain->constrainedStart (when));
chainEvent.deadline = _raw(chain->constrainedDeath (dead.isRegular()? dead:chainEvent.deathTime()));
// ExecutionCtx subCtx{scheduler_, chainEvent};
chainEvent.refineTo (chain, when, dead);
return scheduler_.layer2_.instructFollowUp (chainEvent, scheduler_.layer1_);
}

View file

@ -104755,6 +104755,7 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</node>
<node BACKGROUND_COLOR="#fafe99" COLOR="#fa002a" CREATED="1702949773611" ID="ID_1506062032" MODIFIED="1702954743993" TEXT="Incident: Assertion-Failure aus dem Allokator">
<linktarget COLOR="#e02174" DESTINATION="ID_1506062032" ENDARROW="Default" ENDINCLINATION="-578;34;" ID="Arrow_ID_622434036" SOURCE="ID_1069075638" STARTARROW="None" STARTINCLINATION="186;12;"/>
<linktarget COLOR="#e92d59" DESTINATION="ID_1506062032" ENDARROW="Default" ENDINCLINATION="-129;68;" ID="Arrow_ID_379365083" SOURCE="ID_1140898245" STARTARROW="None" STARTINCLINATION="-245;34;"/>
<icon BUILTIN="broken-line"/>
<node CREATED="1702949832876" ID="ID_131344952" MODIFIED="1702950526092" TEXT="versuche grade den Scheduler zu qu&#xe4;len...">
<icon BUILTIN="smiley-oh"/>
@ -105210,8 +105211,33 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<node COLOR="#338800" CREATED="1702944859030" ID="ID_1931480909" MODIFIED="1703015681827" TEXT="R&#xfc;ckbau / @depreciated : self-Inhibition">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1702945603433" ID="ID_427316058" MODIFIED="1702945614983" TEXT="Klammer in &#x3bb;-post in Hilfsmethode">
<node COLOR="#338800" CREATED="1702945603433" ID="ID_427316058" MODIFIED="1703018549851" TEXT="Klammer in &#x3bb;-post in Hilfsmethode">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1703018528370" ID="ID_1425132739" MODIFIED="1703018548063" TEXT="Umgang mit Grooming-Token f&#xfc;r Planungs-Jobs">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1703018555022" ID="ID_705670834" MODIFIED="1703018575527" TEXT="eigentlich galt das Prinzip vom Desigin: Meta-Jobs haben stets das Grooming-Token"/>
<node CREATED="1703018588843" ID="ID_459468662" MODIFIED="1703018615111" TEXT="aber irgendwie hat sich ein ensureDropGroomingToken() in den postChain() &#x201e;eingeschlichen&#x201c;"/>
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1703018615989" ID="ID_1140898245" MODIFIED="1703018734442">
<richcontent TYPE="NODE"><html>
<head/>
<body>
<p>
das ist <i>nicht </i>gut
</p>
</body>
</html></richcontent>
<richcontent TYPE="NOTE"><html>
<head/>
<body>
<p>
...denn es f&#252;hrt dazu, da&#223; ab der 2. Schleifen-Iteration die Allokation neuer Activities nicht mehr gesch&#252;tzt ist; das k&#246;nnte den beobachteten Crash erkl&#228;ren
</p>
</body>
</html></richcontent>
<arrowlink COLOR="#e92d59" DESTINATION="ID_1506062032" ENDARROW="Default" ENDINCLINATION="-129;68;" ID="Arrow_ID_379365083" STARTARROW="None" STARTINCLINATION="-245;34;"/>
<icon BUILTIN="clanbomber"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1702944889122" ID="ID_816186443" MODIFIED="1702944903543" TEXT="Berechnung der systematisch-erwartbaren Ausf&#xfc;hrungszeit">