Scheduler: implement the tended-next mark
...as KISS solution to put aside the next free capacity whenever a new time point appears at scheduler head
This commit is contained in:
parent
84ca2460c1
commit
6ccb6540e6
3 changed files with 96 additions and 43 deletions
|
|
@ -95,6 +95,7 @@ namespace gear {
|
|||
|
||||
using lib::time::Time;
|
||||
using lib::time::FSecs;
|
||||
using lib::time::TimeVar;
|
||||
using lib::time::Offset;
|
||||
using lib::time::Duration;
|
||||
using std::chrono_literals::operator ""ms;
|
||||
|
|
@ -126,6 +127,8 @@ namespace gear {
|
|||
{
|
||||
BlockFlowAlloc& allocator_;
|
||||
|
||||
TimeVar tendedHead_{Time::ANYTIME};
|
||||
|
||||
public:
|
||||
explicit
|
||||
LoadController (BlockFlowAlloc& blockFlow)
|
||||
|
|
@ -134,18 +137,25 @@ namespace gear {
|
|||
|
||||
|
||||
/**
|
||||
* did we already tend for the indicated next head time?
|
||||
* @note const and non-grooming
|
||||
*/
|
||||
bool
|
||||
tendedNext() const
|
||||
tendedNext (Time nextHead) const
|
||||
{
|
||||
UNIMPLEMENTED ("Predicate to determine if next foreseeable Activity was tended for");
|
||||
return nextHead == tendedHead_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the indicated next head time as tended.
|
||||
* @remark while this is just implemented as simple state,
|
||||
* the meaning is that some free capacity has been directed
|
||||
* towards that time, and thus further capacity go elsewhere.
|
||||
*/
|
||||
void
|
||||
tendNext()
|
||||
tendNext (Time nextHead)
|
||||
{
|
||||
UNIMPLEMENTED ("tend for the next foreseeable Activity");
|
||||
tendedHead_ = nextHead;
|
||||
}
|
||||
|
||||
enum
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ namespace test {
|
|||
{
|
||||
simpleUsage();
|
||||
classifyTimings();
|
||||
tendNextActivity();
|
||||
walkingDeadline();
|
||||
setupLalup();
|
||||
}
|
||||
|
|
@ -94,9 +95,6 @@ namespace test {
|
|||
void
|
||||
classifyTimings()
|
||||
{
|
||||
BlockFlowAlloc bFlow;
|
||||
LoadController ctrl{bFlow};
|
||||
|
||||
Time next{0,10};
|
||||
|
||||
Time ut{1,0};
|
||||
|
|
@ -121,6 +119,46 @@ namespace test {
|
|||
|
||||
|
||||
|
||||
/** @test verify the mark for _tended next head_ Activity.
|
||||
* @todo WIP 10/23 ✔ define ⟶ ✔ implement
|
||||
*/
|
||||
void
|
||||
tendNextActivity()
|
||||
{
|
||||
BlockFlowAlloc bFlow;
|
||||
LoadController lctrl{bFlow};
|
||||
|
||||
Time t1{1,0};
|
||||
Time t2{2,0};
|
||||
Time t3{3,0};
|
||||
|
||||
CHECK (not lctrl.tendedNext (t2));
|
||||
|
||||
lctrl.tendNext (t2);
|
||||
CHECK ( lctrl.tendedNext (t2));
|
||||
CHECK (not lctrl.tendedNext (t3));
|
||||
|
||||
lctrl.tendNext (t3);
|
||||
CHECK ( lctrl.tendedNext (t3));
|
||||
|
||||
// However — this is not a history memory...
|
||||
CHECK (not lctrl.tendedNext (t1));
|
||||
CHECK (not lctrl.tendedNext (t2));
|
||||
CHECK ( lctrl.tendedNext (t3));
|
||||
|
||||
lctrl.tendNext (t1);
|
||||
CHECK ( lctrl.tendedNext (t1));
|
||||
CHECK (not lctrl.tendedNext (t2));
|
||||
CHECK (not lctrl.tendedNext (t3));
|
||||
|
||||
lctrl.tendNext (t2);
|
||||
CHECK (not lctrl.tendedNext (t1));
|
||||
CHECK ( lctrl.tendedNext (t2));
|
||||
CHECK (not lctrl.tendedNext (t3));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test TODO
|
||||
* @todo WIP 10/23 🔁 define ⟶ implement
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -82507,95 +82507,83 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697982455236" ID="ID_645321047" MODIFIED="1697982460315" TEXT="Schemata">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697982678423" ID="ID_77969589" MODIFIED="1697983174220" TEXT="tendNext">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697982717584" ID="ID_267473149" MODIFIED="1697983179411" TEXT="Prüf-Prädikat: tendedNext()">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1697982678423" ID="ID_77969589" MODIFIED="1698072830497" TEXT="tendNext">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1697982717584" ID="ID_267473149" MODIFIED="1698072831864" TEXT="Prüf-Prädikat: tendedNext()">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697982757371" ID="ID_1084006128" MODIFIED="1697983275515" TEXT="const und non-grooming"/>
|
||||
<node CREATED="1697983183366" ID="ID_1016039063" MODIFIED="1697983192701" TEXT="Zugriff auf headTime und Vergleich"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1698072777599" ID="ID_1136303368" MODIFIED="1698072828208" TEXT="Implementierung ist KISS">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1698072785109" ID="ID_110633840" MODIFIED="1698072792145" TEXT="semantisch würde man sich eine Historie erwarten"/>
|
||||
<node CREATED="1698072792645" ID="ID_1751412844" MODIFIED="1698072822477" TEXT="aber zusammen mit der Priority-Queue ergibt sich eine sinnvolle Heuristik"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697983155214" ID="ID_1677472042" MODIFIED="1698026637409" TEXT="classifyCapacity">
|
||||
<arrowlink COLOR="#378f79" DESTINATION="ID_982468485" ENDARROW="Default" ENDINCLINATION="-84;-47;" ID="Arrow_ID_902782295" STARTARROW="None" STARTINCLINATION="31;94;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1697985093803" ID="ID_1553570724" MODIFIED="1698019118162" TEXT="Enum">
|
||||
<icon BUILTIN="info"/>
|
||||
<node CREATED="1698019031467" ID="ID_341356297" MODIFIED="1698019058561" TEXT="DISPATCH">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
sent to work
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1698019039597" ID="ID_1951145257" MODIFIED="1698019068575" TEXT="TENDNEXT">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
reserved for next task
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1697985096625" ID="ID_1387570892" MODIFIED="1698019077986" TEXT="SPINTIME">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
awaiting imminent activities
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1697985096625" ID="ID_1218749290" MODIFIED="1698019089902" TEXT="NEARTIME">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
capacity for active processing required
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1697985096625" ID="ID_1654025176" MODIFIED="1698019099614" TEXT="WORKTIME">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
typical stable work task rhythm expected
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1697985096625" ID="ID_196379275" MODIFIED="1698019109349" TEXT="IDLETIME">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
time to go to sleep
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#435e98" CREATED="1698020940647" ID="ID_307944005" MODIFIED="1698026622294" TEXT="Konfig-Konstanten">
|
||||
|
|
@ -82632,14 +82620,16 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<arrowlink COLOR="#7779a3" DESTINATION="ID_492054934" ENDARROW="Default" ENDINCLINATION="-814;62;" ID="Arrow_ID_817672667" STARTARROW="None" STARTINCLINATION="1393;-112;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1698019149574" HGAP="40" ID="ID_982468485" MODIFIED="1698019158970" TEXT="Fallunterscheidung" VSHIFT="21">
|
||||
<linktarget COLOR="#378f79" DESTINATION="ID_982468485" ENDARROW="Default" ENDINCLINATION="-84;-47;" ID="Arrow_ID_902782295" SOURCE="ID_1677472042" STARTARROW="None" STARTINCLINATION="31;94;"/>
|
||||
<node CREATED="1698019164588" ID="ID_1369255451" MODIFIED="1698019165160" TEXT="incomingCapacity"/>
|
||||
<node CREATED="1698019170228" ID="ID_311501577" MODIFIED="1698019170871" TEXT="outgoingCapacity"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697982436029" ID="ID_288711039" MODIFIED="1697982440270" TEXT="Test">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1697982436029" ID="ID_288711039" MODIFIED="1698073045501" TEXT="Test">
|
||||
<arrowlink COLOR="#56a5a9" DESTINATION="ID_488605324" ENDARROW="Default" ENDINCLINATION="457;-68;" ID="Arrow_ID_1794430254" STARTARROW="None" STARTINCLINATION="-752;0;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
@ -87575,6 +87565,21 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1698072872306" ID="ID_488605324" MODIFIED="1698073045501" TEXT="SchedulerLoadControl_test">
|
||||
<linktarget COLOR="#56a5a9" DESTINATION="ID_488605324" ENDARROW="Default" ENDINCLINATION="457;-68;" ID="Arrow_ID_1794430254" SOURCE="ID_288711039" STARTARROW="None" STARTINCLINATION="-752;0;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1698072995729" ID="ID_130445310" MODIFIED="1698073015042" TEXT="Implementierungs-Details der Load-Control-Mechanismen">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
<node CREATED="1698073016039" ID="ID_1742616307" MODIFIED="1698073017507" TEXT="Fälle">
|
||||
<node COLOR="#338800" CREATED="1698073017869" ID="ID_916925082" MODIFIED="1698073034749" TEXT="classifyTimings">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1698073022938" ID="ID_1539653684" MODIFIED="1698073034749" TEXT="tendNextActivity">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688336835085" ID="ID_1753236898" MODIFIED="1697732777759" TEXT="SchedulerService_test">
|
||||
<linktarget COLOR="#678999" DESTINATION="ID_1753236898" ENDARROW="Default" ENDINCLINATION="-719;-67;" ID="Arrow_ID_197736729" SOURCE="ID_862845398" STARTARROW="None" STARTINCLINATION="-295;159;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue