Scheduler: Layer-1 complete and tested
This commit is contained in:
parent
430f1af4c5
commit
0431a14584
5 changed files with 128 additions and 38 deletions
|
|
@ -74,7 +74,7 @@ namespace gear {
|
|||
void
|
||||
doWork (SchedulerInvocation& layer1)
|
||||
{
|
||||
layer1.feedPriorisation();
|
||||
layer1.feedPrioritisation();
|
||||
while (layer1.isDue (currentSchedulerTime()))
|
||||
{
|
||||
Activity* activity = layer1.pullHead();
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ namespace gear {
|
|||
* and enqueue them according to time order
|
||||
*/
|
||||
void
|
||||
feedPriorisation()
|
||||
feedPrioritisation()
|
||||
{
|
||||
ActOrder actOrder;
|
||||
while (instruct_.pop (actOrder))
|
||||
|
|
@ -133,7 +133,7 @@ namespace gear {
|
|||
* effectively bypassing the thread dispatching entrance queue.
|
||||
*/
|
||||
void
|
||||
feedPriorisation (Activity& activity, Time when)
|
||||
feedPrioritisation (Activity& activity, Time when)
|
||||
{
|
||||
priority_.push (ActOrder{waterLevel(when), &activity});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ END
|
|||
|
||||
|
||||
|
||||
PLANNED "Scheduler Layer-1" SchedulerInvocation_test <<END
|
||||
TEST "Scheduler Layer-1" SchedulerInvocation_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
||||
|
|
|
|||
|
|
@ -27,14 +27,9 @@
|
|||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "vault/gear/scheduler-invocation.hpp"
|
||||
//#include "lib/time/timevalue.hpp"
|
||||
//#include "lib/format-cout.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
//#include <utility>
|
||||
|
||||
using test::Test;
|
||||
//using std::move;
|
||||
using util::isSameObject;
|
||||
|
||||
|
||||
|
|
@ -42,11 +37,6 @@ namespace vault{
|
|||
namespace gear {
|
||||
namespace test {
|
||||
|
||||
// using lib::time::FrameRate;
|
||||
// using lib::time::Offset;
|
||||
// using lib::time::Time;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -64,6 +54,8 @@ namespace test {
|
|||
simpleUsage();
|
||||
verify_Queuing();
|
||||
verify_WaterLevel();
|
||||
verify_stability();
|
||||
verify_isDue();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -79,32 +71,119 @@ namespace test {
|
|||
CHECK (not sched.peekHead());
|
||||
|
||||
sched.instruct (activity, when);
|
||||
sched.feedPriorisation();
|
||||
sched.feedPrioritisation();
|
||||
CHECK (sched.peekHead());
|
||||
|
||||
Activity* head = sched.pullHead();
|
||||
CHECK (not sched.peekHead());
|
||||
CHECK (isSameObject (*head, activity));
|
||||
CHECK (isSameObject (*head, activity));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test TODO verify records are passed properly through the queues
|
||||
/** @test verify records are passed properly through the queues
|
||||
* - add multiple elements to the instruct queue
|
||||
* - after `feedPrioritisation` these appear as output
|
||||
*/
|
||||
void
|
||||
verify_Queuing()
|
||||
{
|
||||
UNIMPLEMENTED ("queues");
|
||||
SchedulerInvocation sched;
|
||||
Activity one{1u,1u};
|
||||
Activity two{2u,2u};
|
||||
Activity ree{3u,3u};
|
||||
Time t{5,5};
|
||||
|
||||
sched.instruct (one, t);
|
||||
sched.instruct (two, t);
|
||||
sched.instruct (ree, t);
|
||||
CHECK (not sched.peekHead());
|
||||
|
||||
sched.feedPrioritisation();
|
||||
CHECK (isSameObject (*sched.pullHead(), one));
|
||||
CHECK (isSameObject (*sched.pullHead(), two));
|
||||
CHECK (isSameObject (*sched.pullHead(), ree));
|
||||
CHECK (not sched.peekHead());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test TODO verify the given time point is utilised for prioritisation
|
||||
/** @test verify the given time point is utilised for prioritisation
|
||||
* - order at output is determined by the time spec
|
||||
* - even later added elements can push back
|
||||
* previously visible elements at head
|
||||
*/
|
||||
void
|
||||
verify_WaterLevel()
|
||||
{
|
||||
UNIMPLEMENTED ("water level");
|
||||
SchedulerInvocation sched;
|
||||
Activity a1{1u,1u};
|
||||
Activity a2{2u,2u};
|
||||
Activity a3{3u,3u};
|
||||
Activity a4{4u,4u};
|
||||
|
||||
sched.instruct (a2, Time{2,0});
|
||||
sched.instruct (a4, Time{4,0});
|
||||
sched.feedPrioritisation();
|
||||
CHECK (isSameObject (*sched.peekHead(), a2));
|
||||
|
||||
sched.instruct (a3, Time{3,0});
|
||||
sched.instruct (a1, Time{1,0});
|
||||
CHECK (isSameObject (*sched.peekHead(), a2));
|
||||
|
||||
sched.feedPrioritisation();
|
||||
CHECK (isSameObject (*sched.pullHead(), a1));
|
||||
CHECK (isSameObject (*sched.pullHead(), a2));
|
||||
CHECK (isSameObject (*sched.pullHead(), a3));
|
||||
CHECK (isSameObject (*sched.pullHead(), a4));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test sort order is not necessarily stable
|
||||
* if using identical time specs on entrance
|
||||
*/
|
||||
void
|
||||
verify_stability()
|
||||
{
|
||||
SchedulerInvocation sched;
|
||||
Activity a1{1u,1u};
|
||||
Activity a2{2u,2u};
|
||||
Activity a3{3u,3u};
|
||||
Activity a4{4u,4u};
|
||||
|
||||
sched.feedPrioritisation (a1, Time{0,5});
|
||||
sched.feedPrioritisation (a2, Time{0,5});
|
||||
sched.feedPrioritisation (a3, Time{0,5});
|
||||
sched.feedPrioritisation (a4, Time{0,4});
|
||||
CHECK (isSameObject (*sched.pullHead(), a4));
|
||||
CHECK (isSameObject (*sched.pullHead(), a3));
|
||||
CHECK (isSameObject (*sched.pullHead(), a1));
|
||||
CHECK (isSameObject (*sched.pullHead(), a2));
|
||||
CHECK (not sched.pullHead());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test the entry appearing at head _is due_
|
||||
* when its time is at or before current time.
|
||||
*/
|
||||
void
|
||||
verify_isDue()
|
||||
{
|
||||
SchedulerInvocation sched;
|
||||
Activity a1{1u,1u};
|
||||
|
||||
sched.feedPrioritisation (a1, Time{0,5});
|
||||
CHECK (isSameObject (*sched.peekHead(), a1));
|
||||
CHECK ( sched.isDue (Time{0,10}));
|
||||
CHECK ( sched.isDue (Time{0,5}));
|
||||
CHECK (not sched.isDue (Time{0,1}));
|
||||
|
||||
sched.pullHead();
|
||||
CHECK (not sched.peekHead());
|
||||
CHECK (not sched.isDue (Time{0,1}));
|
||||
CHECK (not sched.isDue (Time{0,10}));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -81687,14 +81687,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
<node CREATED="1687737451105" ID="ID_925616893" MODIFIED="1687737457699" TEXT="Basis-Operationen">
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1687737459167" ID="ID_1982661220" MODIFIED="1693172276491" TEXT="instruct">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1687737917521" ID="ID_1306162732" MODIFIED="1687737926950" TEXT="water-level definieren">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697497880339" ID="ID_1428475873" MODIFIED="1697497967166" TEXT="Bedeutung der Zeitangaben klären">
|
||||
<node COLOR="#338800" CREATED="1687737459167" ID="ID_1982661220" MODIFIED="1697509756856" TEXT="instruct">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1687737917521" ID="ID_1306162732" MODIFIED="1697509754333" TEXT="water-level definieren">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1697497880339" ID="ID_1428475873" MODIFIED="1697509747869" TEXT="Bedeutung der Zeitangaben klären">
|
||||
<arrowlink COLOR="#7d7d95" DESTINATION="ID_1707163520" ENDARROW="Default" ENDINCLINATION="-66;1053;" ID="Arrow_ID_1162895595" STARTARROW="None" STARTINCLINATION="803;63;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1697498014282" HGAP="101" ID="ID_1790216070" MODIFIED="1697503059905" TEXT="Zeitangaben sind verwirrend" VSHIFT="21">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1697498014282" HGAP="101" ID="ID_1790216070" MODIFIED="1697509750845" TEXT="Zeitangaben sind verwirrend" VSHIFT="21">
|
||||
<font NAME="SansSerif" SIZE="11"/>
|
||||
<icon BUILTIN="bell"/>
|
||||
<node CREATED="1697502661099" ID="ID_1427644322" MODIFIED="1697502675671" TEXT="hier geht die Bedeutung der PriQueue explizit ein"/>
|
||||
|
|
@ -81703,7 +81703,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693269129210" ID="ID_1992882157" MODIFIED="1697503085690" TEXT="diese Zeit muß explizit als Parameter gegeben sein">
|
||||
<node COLOR="#435e98" CREATED="1693269129210" ID="ID_1992882157" MODIFIED="1697509743431" TEXT="diese Zeit muß explizit als Parameter gegeben sein">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1697503108192" ID="ID_1302864247" MODIFIED="1697503118285" TEXT="das ist ein Freiheitsgrad des POST-Eingangs"/>
|
||||
<node CREATED="1697503124087" ID="ID_1183635639" MODIFIED="1697503267864" TEXT="ist auch gut so: keine enge Kopplung zwischen Commutator und Activity-Language">
|
||||
|
|
@ -81762,7 +81762,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1687825916348" ID="ID_254177626" MODIFIED="1687826402411" TEXT="feedPriorisation">
|
||||
<node COLOR="#338800" CREATED="1687825916348" ID="ID_254177626" MODIFIED="1687826402411" TEXT="feedPrioritisation">
|
||||
<linktarget COLOR="#31c960" DESTINATION="ID_254177626" ENDARROW="Default" ENDINCLINATION="169;9;" ID="Arrow_ID_1506119350" SOURCE="ID_167939453" STARTARROW="None" STARTINCLINATION="-2;9;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1697474990041" HGAP="39" ID="ID_1899510010" MODIFIED="1697483151657" TEXT="wie wird der Bypass der Instruct-Queue realisiert?" VSHIFT="39">
|
||||
|
|
@ -81807,8 +81807,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1697496207636" HGAP="102" ID="ID_781957236" MODIFIED="1697496249867" TEXT="feedPriorisation (Activity&)" VSHIFT="-10">
|
||||
<node COLOR="#338800" CREATED="1697496207636" HGAP="102" ID="ID_781957236" MODIFIED="1697509761395" TEXT="feedPrioritisation (Activity&)" VSHIFT="-10">
|
||||
<linktarget COLOR="#7280a9" DESTINATION="ID_781957236" ENDARROW="Default" ENDINCLINATION="30;-53;" ID="Arrow_ID_783538344" SOURCE="ID_410099903" STARTARROW="None" STARTINCLINATION="-116;7;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697496266988" ID="ID_1227453518" MODIFIED="1697496280877" TEXT="Name: erscheint mir logisch"/>
|
||||
<node COLOR="#5b280f" CREATED="1697496282650" ID="ID_1795543272" MODIFIED="1697496411465" TEXT="gefährlich? �� das ist kein Thema">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
|
|
@ -85868,12 +85869,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688336761542" ID="ID_145928010" MODIFIED="1688337246571" TEXT="SchedulerInvocation_test">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1688336761542" ID="ID_145928010" MODIFIED="1697509851855" TEXT="SchedulerInvocation_test">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1688337123318" ID="ID_1686181795" MODIFIED="1688337233916" TEXT="»Layer-1« : Queue operation">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697473080944" ID="ID_1787410167" MODIFIED="1697493162214" TEXT="Aufgabe: die low-Level Operationen durchspielen">
|
||||
<node COLOR="#435e98" CREATED="1697473080944" ID="ID_1787410167" MODIFIED="1697509867150" TEXT="Aufgabe: die low-Level Operationen durchspielen">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697483171239" ID="ID_1311717572" MODIFIED="1697493792567" TEXT="scaffolding">
|
||||
|
|
@ -85881,16 +85882,26 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1697483188828" ID="ID_1400224430" MODIFIED="1697483199834" TEXT="direkt konstruierte Activity-Records"/>
|
||||
<node CREATED="1697483303661" ID="ID_1179779450" MODIFIED="1697483324629" TEXT="eingeben und query-API prüfen"/>
|
||||
</node>
|
||||
<node CREATED="1697493793732" ID="ID_597348426" MODIFIED="1697493796531" TEXT="Fälle">
|
||||
<node COLOR="#435e98" CREATED="1697493793732" ID="ID_597348426" MODIFIED="1697509849880" TEXT="Fälle">
|
||||
<node COLOR="#338800" CREATED="1697493804379" ID="ID_1199251760" MODIFIED="1697503985564" TEXT="simpleUsage">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1697495848896" ID="ID_1473786655" MODIFIED="1697495859530" TEXT="muß eine INITIAL_CAPACITY hinterlegen"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697503875664" ID="ID_709664850" MODIFIED="1697503976308" TEXT="verify_Queuing">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1697503875664" ID="ID_709664850" MODIFIED="1697509770695" TEXT="verify_Queuing">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697503841856" ID="ID_1434499377" LINK="#ID_1306162732" MODIFIED="1697505281285" TEXT="verify_WaterLevel">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1697503841856" ID="ID_1434499377" LINK="#ID_1306162732" MODIFIED="1697509772561" TEXT="verify_WaterLevel">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697509780561" ID="ID_858986653" MODIFIED="1697509782527" TEXT="verify_stability">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1697509794959" HGAP="42" ID="ID_1096817467" MODIFIED="1697509843296" TEXT="might be implementation-defined behaviour" VSHIFT="2">
|
||||
<font NAME="SansSerif" SIZE="11"/>
|
||||
<icon BUILTIN="clanbomber"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697509788872" ID="ID_1245618573" MODIFIED="1697509790525" TEXT="verify_isDue">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue