Block-Flow: define next steps for implementation of low-level allocator
This commit is contained in:
parent
ccf0710903
commit
c1b16349f2
3 changed files with 151 additions and 18 deletions
|
|
@ -61,7 +61,9 @@ namespace mem {
|
|||
|
||||
// using util::isnil;
|
||||
// using std::string;
|
||||
|
||||
template<typename T, size_t siz>
|
||||
class ExtentDiagnostic;
|
||||
|
||||
|
||||
/**
|
||||
* Memory manager to provide a sequence of Extents for cyclic usage.
|
||||
|
|
@ -123,9 +125,30 @@ namespace mem {
|
|||
extents_.reserve (expectedMaxExtents);
|
||||
}
|
||||
|
||||
void
|
||||
openNew (size_t cnt)
|
||||
{
|
||||
UNIMPLEMENTED ("claim next cnt extents, possibly allocate");
|
||||
}
|
||||
|
||||
void
|
||||
dropOld (size_t cnt)
|
||||
{
|
||||
UNIMPLEMENTED ("discard oldest cnt extents");
|
||||
}
|
||||
|
||||
|
||||
/** allow transparent iteration of Extents, expanding storage on demand */
|
||||
using iterator = lib::IterAdapter<RawIter, ExtentFamily*>; ////////////////////OOO consider to use a Extent* instead of the RawIter??
|
||||
|
||||
|
||||
iterator
|
||||
active()
|
||||
{
|
||||
UNIMPLEMENTED ("visit all active extents, possibly claim next ones");
|
||||
}
|
||||
|
||||
|
||||
/* == Iteration control API (used by IterAdapter via ADL) == */
|
||||
|
||||
friend bool
|
||||
|
|
@ -139,9 +162,31 @@ namespace mem {
|
|||
{
|
||||
UNIMPLEMENTED ("ExtentFamily iteration control: access next Extent, possibly expand allocation");
|
||||
}
|
||||
|
||||
friend class ExtentDiagnostic<T,siz>;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename T, size_t siz>
|
||||
struct ExtentDiagnostic
|
||||
{
|
||||
using ExFam = ExtentFamily<T,siz>;
|
||||
|
||||
ExFam& exFam_;
|
||||
|
||||
size_t first() { return exFam_.start_; }
|
||||
size_t last() { return exFam_.after_; }
|
||||
size_t size() { return exFam_.extents_.size(); }
|
||||
size_t active() { UNIMPLEMENTED ("count active"); }
|
||||
};
|
||||
|
||||
template<typename T, size_t siz>
|
||||
inline ExtentDiagnostic<T,siz>
|
||||
watch (ExtentFamily<T,siz>& extentFamily)
|
||||
{
|
||||
return ExtentDiagnostic<T,siz>{extentFamily};
|
||||
}
|
||||
|
||||
}} // namespace vault::mem
|
||||
#endif /*SRC_VAULT_MEM_EXTENT_FAMILY_H_*/
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@
|
|||
//#include "lib/format-cout.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
//#include <utility>
|
||||
#include <utility>
|
||||
|
||||
using test::Test;
|
||||
//using std::move;
|
||||
//using util::isSameObject;
|
||||
using util::isSameObject;
|
||||
|
||||
|
||||
namespace vault{
|
||||
|
|
@ -46,6 +46,10 @@ namespace test {
|
|||
// using lib::time::Offset;
|
||||
// using lib::time::Time;
|
||||
|
||||
using Extents = ExtentFamily<int, 10>;
|
||||
using Extent = Extents::Extent;
|
||||
using Iter = Extents::iterator;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -62,8 +66,9 @@ namespace test {
|
|||
run (Arg)
|
||||
{
|
||||
simpleUsage();
|
||||
calculateDeadline();
|
||||
setupDependentJob();
|
||||
use_and_drop();
|
||||
iteration();
|
||||
wrapAround();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -72,26 +77,79 @@ namespace test {
|
|||
void
|
||||
simpleUsage()
|
||||
{
|
||||
ExtentFamily<int, 10> extents{5};
|
||||
Extents extents{5};
|
||||
Extent& extent = extents.active()->access(); //////////////////////////////////////////OOO better Iter implementation for direct access
|
||||
CHECK (10 == extent.size());
|
||||
|
||||
int num = rand() % 1000;
|
||||
extent[2] = num;
|
||||
extent[5] = num+5;
|
||||
CHECK (num == extent[2]);
|
||||
CHECK (num+5 == extent[5]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test verify the timing calculations to establish
|
||||
* the scheduling deadline of a simple render job
|
||||
/** @test verify claiming new and discarding old slots
|
||||
*/
|
||||
void
|
||||
calculateDeadline()
|
||||
use_and_drop()
|
||||
{
|
||||
ExtentFamily<int, 10> extents{5};
|
||||
CHECK ( 0 == watch(extents).first());
|
||||
CHECK ( 0 == watch(extents).last());
|
||||
CHECK ( 0 == watch(extents).active());
|
||||
CHECK ( 5 == watch(extents).size());
|
||||
|
||||
extents.openNew(3);
|
||||
CHECK ( 0 == watch(extents).first());
|
||||
CHECK ( 3 == watch(extents).last());
|
||||
CHECK ( 3 == watch(extents).active());
|
||||
CHECK ( 5 == watch(extents).size());
|
||||
|
||||
extents.dropOld(2);
|
||||
CHECK ( 2 == watch(extents).first());
|
||||
CHECK ( 3 == watch(extents).last());
|
||||
CHECK ( 1 == watch(extents).active());
|
||||
CHECK ( 5 == watch(extents).size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test verify the setup of a prerequisite job in relation
|
||||
* to the master job depending on this prerequisite
|
||||
/** @test verify access to the extents by iteration,
|
||||
* thereby possibly claiming the next extents
|
||||
*/
|
||||
void
|
||||
setupDependentJob()
|
||||
iteration()
|
||||
{
|
||||
Extents extents{5};
|
||||
Iter it = extents.active();
|
||||
CHECK (it);
|
||||
|
||||
Extent& extent = it->access(); ////////////////////////////////////////////////////////OOO better Iter implementation for direct access
|
||||
CHECK (10 == extent.size());
|
||||
|
||||
int num = rand() % 1000;
|
||||
extent[2] = num;
|
||||
CHECK (num == extent[2]);
|
||||
|
||||
++it;
|
||||
CHECK (it);
|
||||
Extent& nextEx = it->access();
|
||||
CHECK (not isSameObject(extent, nextEx));
|
||||
nextEx[5] = extent[2] + 1;
|
||||
CHECK (num == extent[2]);
|
||||
CHECK (num+1 == nextEx[5]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test verify in detail how iteration wraps around to also reuse
|
||||
* previously dropped extents, possibly rearranging the internal
|
||||
* management-vector to allow growing new extents at the end.
|
||||
*/
|
||||
void
|
||||
wrapAround()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -78506,9 +78506,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1688515126831" ID="ID_1528998679" MODIFIED="1688515184828" TEXT="Epoche aktiv oder obsolet"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688394889309" ID="ID_1132827905" MODIFIED="1688398856923" TEXT="ExtentFamily_test">
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1688394889309" ID="ID_1132827905" MODIFIED="1688868065166" TEXT="ExtentFamily_test">
|
||||
<linktarget COLOR="#eb4070" DESTINATION="ID_1132827905" ENDARROW="Default" ENDINCLINATION="-593;73;" ID="Arrow_ID_709934622" SOURCE="ID_504623704" STARTARROW="None" STARTINCLINATION="-214;-18;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1688394900403" ID="ID_1380392473" MODIFIED="1688394919878" TEXT="underlying sequence-of-extents">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
|
|
@ -78517,6 +78517,33 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node COLOR="#338800" CREATED="1688434743454" ID="ID_722620082" MODIFIED="1688434762609" TEXT="ExtentFamily erzeugen mit pre-Allocation">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1688862941032" ID="ID_1514279635" MODIFIED="1688868055421" TEXT="Diagnose der tatsächlichen Speicherbelegung">
|
||||
<icon BUILTIN="pencil"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688863035539" ID="ID_557979292" MODIFIED="1688864962621" TEXT="belegen und Aufräumen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688862915795" ID="ID_871871038" MODIFIED="1688862919588" TEXT="iteration">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688862977234" ID="ID_1512460521" MODIFIED="1688862993698" TEXT="iteration eröffnet weitere Extents">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688862995665" ID="ID_469578407" MODIFIED="1688863007703" TEXT="man kann erneut über Extents iterieren">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688863046274" ID="ID_121256425" MODIFIED="1688863054657" TEXT="iteration mit wrap-around">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688863075348" ID="ID_619946525" MODIFIED="1688863105883" TEXT="Iteration in Normal-Stellung alloziert am Ende">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688863063471" ID="ID_1548989724" MODIFIED="1688863074305" TEXT="Iteration belegt freigegebene Extents erneut">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688863109043" ID="ID_1214274693" MODIFIED="1688863138245" TEXT="stößt die Iteration nach wrap-around an Grenzen, so wird re-Normalisiert">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688336697451" ID="ID_360159435" MODIFIED="1688337246569" TEXT="SchedulerActivity_test">
|
||||
|
|
@ -78784,8 +78811,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688398813243" ID="ID_504623704" MODIFIED="1688398863035" TEXT="Aufbau testgetrieben...">
|
||||
<arrowlink COLOR="#eb4070" DESTINATION="ID_1132827905" ENDARROW="Default" ENDINCLINATION="-593;73;" ID="Arrow_ID_709934622" STARTARROW="None" STARTINCLINATION="-214;-18;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688398884005" ID="ID_1188543253" MODIFIED="1688398901314" TEXT="Basis-Struktur">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1688398884005" ID="ID_1188543253" MODIFIED="1688867997850" TEXT="Basis-Struktur">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1688432746255" ID="ID_880122043" MODIFIED="1688432851088" TEXT="Entscheidung: die Größe ist eine compile-time-Konstante">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
|
@ -78829,7 +78856,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node COLOR="#338800" CREATED="1688432504244" ID="ID_1241185228" MODIFIED="1688556470257" TEXT="Storage (privat)">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688432516234" ID="ID_615463720" MODIFIED="1688432527931" TEXT="Anfroderung: keine Initialisierung">
|
||||
<node COLOR="#435e98" CREATED="1688432516234" ID="ID_615463720" MODIFIED="1688867994355" TEXT="Anfroderung: keine Initialisierung">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1688432531628" ID="ID_370870831" MODIFIED="1688432652286" TEXT="wichtig für die Performance">
|
||||
<icon BUILTIN="yes"/>
|
||||
|
|
@ -79057,12 +79084,15 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688516199288" ID="ID_1824919687" MODIFIED="1688516212258" TEXT="Epochen-Deadline">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1688516220648" ID="ID_1169377280" MODIFIED="1688516237353" TEXT="steht in einem Gate im 1.Slot"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688553471328" HGAP="24" ID="ID_262514506" MODIFIED="1688855532469" TEXT="dafür eigenen Sub-Typ anliegen: EpochGate" VSHIFT="7">
|
||||
<node COLOR="#435e98" CREATED="1688553471328" HGAP="24" ID="ID_262514506" MODIFIED="1688868016296" TEXT="dafür eigenen Sub-Typ anliegen: EpochGate" VSHIFT="7">
|
||||
<linktarget COLOR="#87335c" DESTINATION="ID_262514506" ENDARROW="Default" ENDINCLINATION="-51;-3;" ID="Arrow_ID_1549134996" SOURCE="ID_805170537" STARTARROW="None" STARTINCLINATION="57;6;"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1688855534850" ID="ID_568063333" MODIFIED="1688855541413" TEXT="eine Activity vom Typ GATE"/>
|
||||
<node CREATED="1688855549226" ID="ID_739862110" MODIFIED="1688855565203" TEXT="wird aber speziell vorinitialisiert"/>
|
||||
<node CREATED="1688855565956" ID="ID_1537513041" MODIFIED="1688855590150" TEXT="der next-Pointer zeigt hier auf den nächsten freien Slot"/>
|
||||
<node COLOR="#338800" CREATED="1688868023638" ID="ID_40051691" MODIFIED="1688868035961" TEXT="verwaltet verfügbare Slots">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688554963598" ID="ID_708490850" MODIFIED="1688554971708" TEXT="Füllstand der Epoche">
|
||||
|
|
|
|||
Loading…
Reference in a new issue