Activity-Lang: verify memory allocation and connectivity

This commit is contained in:
Fischlurch 2023-08-29 18:46:37 +02:00
parent 3bd4305dab
commit cda1cdd975
5 changed files with 81 additions and 28 deletions

View file

@ -181,8 +181,8 @@ namespace gear {
void
insertWorkBracket()
{
auto start = alloc_.create (Activity::WORKSTART);
auto stop = alloc_.create (Activity::WORKSTOP);
Activity& start = alloc_.create (Activity::WORKSTART);
Activity& stop = alloc_.create (Activity::WORKSTOP);
/////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1283 define the "quality" parameter to distinguish observable execution times
insert (gate_? gate_: post_, &start);

View file

@ -674,6 +674,16 @@ namespace gear {
.transform([](Epoch& a){ return TimeValue{a.deadline()}; });
return util::join(deadlines, "|");
}
/** count all currently active allocated elements */
size_t
cntElm()
{
size_t cnt{0};
for (auto& epoch : flow_.allEpochs())
cnt += epoch.gate().filledSlots();
return cnt;
}
};
template<class CONF>

View file

@ -104,12 +104,14 @@ namespace test {
Activity& tick = bFlow.until(deadline).create();
CHECK (tick.verb_ == Activity::TICK);
CHECK (1 == watch(bFlow).cntElm());
CHECK (1 == watch(bFlow).cntEpochs());
CHECK (watch(bFlow).first() > deadline);
CHECK (watch(bFlow).first() - deadline == bFlow.getEpochStep());
bFlow.discardBefore (deadline + Time{0,5});
CHECK (0 == watch(bFlow).cntEpochs());
CHECK (0 == watch(bFlow).cntElm());
}
@ -296,6 +298,9 @@ namespace test {
CHECK (watch(bFlow).allEpochs() == "10s200ms|10s400ms|10s600ms|10s800ms|11s|11s192ms|11s384ms|11s576ms"_expect);
CHECK (watch(bFlow).find(a7) == "11s576ms"_expect);
// we created 8 elements (a0...a7) and caused three epochs to overflow...
CHECK (watch(bFlow).cntElm() == 8 + EXTENT_SIZ-1 + EXTENT_SIZ-1 + EXTENT_SIZ-2);
// on clean-up, actual fill ratio is used to adjust to optimise Epoch length for better space usage
CHECK (bFlow.getEpochStep() == "≺192ms≻"_expect);
bFlow.discardBefore (Time{999,10});

View file

@ -359,19 +359,44 @@ namespace test {
BlockFlowAlloc bFlow;
ActivityLang activityLang{bFlow};
Job job = detector.buildMockJob();
Time start{0,1};
Time dead{0,10};
auto term = activityLang.buildCalculationJob (job,start,dead);
Activity* act{nullptr};
{
auto term = activityLang.buildCalculationJob (detector.buildMockJob(), start,dead);
act = & term.post();
}// NOTE: generated Activity chain remains valid after term goes out of scope
cout << watch(bFlow).allEpochs() <<endl;
cout << watch(bFlow).cntEpochs() <<endl;
cout << watch(bFlow).cntElm() <<endl;
cout << watch(bFlow).find(*act) <<endl;
// Values reported for the BlockFlow allocator look sane...
CHECK (watch(bFlow).cntElm() == 7); // POST, GATE, WORKSTART, INVOKE, FEED, FEED, WORKSTOP
CHECK (watch(bFlow).cntEpochs() == 1); // all placed into a single epoch...
CHECK (watch(bFlow).find(*act) > dead); // which terminates shortly after the given deadline
CHECK (watch(bFlow).find(*act) < dead+Time(500,0));
// Time window parameters have been included
Activity& post = term.post();
CHECK (Activity::POST == post.verb_);
CHECK (start == post.data_.timeWindow.life);
CHECK (dead == post.data_.timeWindow.dead);
CHECK (Activity::POST == act->verb_);
CHECK (start == act->data_.timeWindow.life);
CHECK (dead == act->data_.timeWindow.dead);
cout << term<<endl;
// sane wiring, leading to an INVOCATE eventually
while (act->verb_ != Activity::INVOKE)
{
cout << util::showAddr(*act) << " verb="<<act->verb_ <<" next="<<util::showAddr(*act->next)<<" next.verb="<<act->next->verb_<<endl;
cout << *act <<endl;
cout << watch(bFlow).find(*act) <<endl;
act = act->next;
}
CHECK (Activity::INVOKE == act->verb_);
cout << *act <<endl;
cout << watch(bFlow).find(*act) <<endl;
CHECK (watch(bFlow).find(*act) != Time::NEVER); // can also be found within the BlockFlow allocator
}

View file

@ -77961,10 +77961,14 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</node>
</node>
<node CREATED="1693178622450" ID="ID_702953156" MODIFIED="1693178792128" TEXT="fallbezogen">
<node CREATED="1693178646683" ID="ID_1322750884" MODIFIED="1693178660593" TEXT="Klammer Workstart|stop"/>
<node COLOR="#338800" CREATED="1693178646683" ID="ID_1322750884" MODIFIED="1693327429521" TEXT="Klammer Workstart|stop">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1693178702928" ID="ID_973455223" MODIFIED="1693178762434" TEXT="Verbindung Feed&#x27f6;Worksop | Callback"/>
<node CREATED="1693178764856" ID="ID_1455997570" MODIFIED="1693178773842" TEXT="optional/mandatory">
<node CREATED="1693178780905" ID="ID_1918846546" MODIFIED="1693178783337" TEXT="Gate"/>
<node COLOR="#338800" CREATED="1693178780905" ID="ID_1918846546" MODIFIED="1693327436464" TEXT="Gate">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1693178785229" ID="ID_820032876" MODIFIED="1693178786896" TEXT="Notify"/>
</node>
</node>
@ -78041,8 +78045,8 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688999216020" ID="ID_1652417442" MODIFIED="1689000686850" TEXT="Nutzungs-Zyklus">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688999221795" ID="ID_1575286737" MODIFIED="1688999234827" TEXT="der Term selbst ist transient">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1688999221795" ID="ID_1575286737" MODIFIED="1693327452333" TEXT="der Term selbst ist transient">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688999245632" ID="ID_1036154230" MODIFIED="1689000708795">
<richcontent TYPE="NODE"><html>
@ -78077,12 +78081,12 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693269074177" ID="ID_715918201" MODIFIED="1693269098396" TEXT="&#x27f9; Konsequenz: es wird eine POST-Activity erwartet"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688999304504" ID="ID_564520426" MODIFIED="1688999317361" TEXT="der Term bleibt auch nach dem Instruct() valide">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688999331796" ID="ID_1974598754" MODIFIED="1688999364152" TEXT="Builder-Operationen sind vorher g&#xfc;ltig">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1688999304504" ID="ID_564520426" MODIFIED="1693327475634" TEXT="der Term bleibt auch nach dem Instruct() valide">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1688999331796" ID="ID_1974598754" MODIFIED="1693327479852" TEXT="Builder-Operationen sind vorher g&#xfc;ltig">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688999346517" ID="ID_124536874" MODIFIED="1688999585602">
<node COLOR="#338800" CREATED="1688999346517" ID="ID_124536874" MODIFIED="1693327476995">
<richcontent TYPE="NODE"><html>
<head/>
<body>
@ -78094,7 +78098,7 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</p>
</body>
</html></richcontent>
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="button_ok"/>
<node CREATED="1688999377072" ID="ID_1659636663" MODIFIED="1688999591757" TEXT="&#xbb;auf eigene Gefahr&#xab;">
<icon BUILTIN="yes"/>
</node>
@ -78135,8 +78139,8 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688999319686" ID="ID_1484039920" MODIFIED="1688999329565" TEXT="der Term kann jederzeit ohne Seiteneffekt gel&#xf6;scht werden">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1688999319686" ID="ID_1484039920" MODIFIED="1693327501431" TEXT="der Term kann jederzeit ohne Seiteneffekt gel&#xf6;scht werden">
<icon BUILTIN="button_ok"/>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1688999694596" ID="ID_504534684" MODIFIED="1693271078574" TEXT="Term-Build setzt GroomingToken vorraus">
<richcontent TYPE="NOTE"><html>
<head/>
@ -80139,15 +80143,15 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1693269199928" ID="ID_185134867" MODIFIED="1693323275781" TEXT="minimale Ausstattung verifizieren">
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1693269199928" ID="ID_185134867" MODIFIED="1693327363610" TEXT="minimale Ausstattung verifizieren">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1693275251993" ID="ID_101711182" MODIFIED="1693275264459" TEXT="Ankerpunkt ist eine POST-Activity">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1693269490081" ID="ID_815043128" MODIFIED="1693323265343" TEXT="POST hat das Timing-Window &#xfc;bernommen">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693269535563" ID="ID_1083096028" MODIFIED="1693275264466" TEXT="Activities sind verlinkt">
<node COLOR="#338800" CREATED="1693269535563" ID="ID_1083096028" MODIFIED="1693327356700" TEXT="Activities sind verlinkt">
<richcontent TYPE="NOTE"><html>
<head/>
<body>
@ -80156,14 +80160,23 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</p>
</body>
</html></richcontent>
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693269471291" ID="ID_212963309" MODIFIED="1693269480482" TEXT="Ausf&#xfc;hrbarkeit der Invocation">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693269686406" ID="ID_482075327" MODIFIED="1693269696741" TEXT="BlockFlow - Zustand">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1693269686406" ID="ID_482075327" MODIFIED="1693327322538" TEXT="BlockFlow - Zustand">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1693327323663" ID="ID_1116744378" MODIFIED="1693327349540" TEXT="7 Activities belegt">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1693327333758" ID="ID_1084060090" MODIFIED="1693327349540" TEXT="alle in einer Epoche">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1693327337525" ID="ID_913338317" MODIFIED="1693327349540" TEXT="diese Epoche endet knapp hinter der gegebenen Deadline">
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689200553782" ID="ID_472609287" MODIFIED="1689200578260" TEXT="scenario_RenderJob">