![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
#include "vault/gear/block-flow.hpp"
Allocation scheme for the Scheduler, based on Epoch(s).
Scheduling entails to provide a chain of Activity definitions, which will then »flow« through the priority queue until invocation.
Definition at line 341 of file block-flow.hpp.
Classes | |
| class | AllocatorHandle |
| Local handle to allow allocating a collection of Activities, all sharing a common deadline. More... | |
| class | StorageAdaptor |
| Adapt the access to the raw storage to present the Extents as Epoch; also caches the address resolution for performance reasons (+20%). More... | |
Public Types | |
| using | Allocator = mem::ExtentFamily< Activity, EPOCH_SIZ > |
| using | Strategy = blockFlow::Strategy< CONF > |
| using | RawIter = Allocator::iterator |
| using | Extent = Allocator::Extent |
| using | Epoch = blockFlow::Epoch< Allocator > |
| using | EpochIter = lib::IterableDecorator< StorageAdaptor > |
| Adapted storage-Extent iterator, directly exposing Epoch&. | |
Public Attributes | |
| Duration | _cache_timeStep_cutOff = Strategy::timeStep_cutOff() |
| double | _cache_boostFactorOverflow = Strategy::boostFactorOverflow() |
Public Member Functions | |
| BlockFlow () | |
| Duration | getEpochStep () const |
| void | adjustEpochStep (double factor) |
| AllocatorHandle | until (Time deadline) |
| initiate allocations for activities to happen until some deadline | |
| void | discardBefore (Time deadline) |
| Clean-up all storage related to activities before the given deadline. | |
| void | markEpochOverflow () |
| Notify and adjust Epoch capacity as consequence of exhausting an Epoch. | |
| void | markEpochUnderflow (TimeVar actualLen, double fillFactor) |
| On clean-up of past Epochs, the actual fill factor is checked to guess an Epoch duration to make optimal use of epoch storage. | |
| void | announceAdditionalFlow (FrameRate additionalFps) |
| provide a hint to the self-regulating allocation scheme. | |
| CONF const & | config () const |
Public Member Functions inherited from Strategy< CONF > | |
| CONF const & | config () const |
| size_t | framesPerEpoch () const |
| size_t | initialFrameRate () const |
| Duration | initialEpochStep () const |
| size_t | initialEpochCnt () const |
| < reserve allocation headroom for two duty cycles | |
| size_t | averageEpochs () const |
| double | boostFactor () const |
| double | boostFactorOverflow () const |
| < reduced logarithmically, since overflow is detected on individual allocations | |
| Duration | timeStep_cutOff () const |
| < prevent stalling Epoch progression when reaching saturation | |
Friends | |
| class | FlowDiagnostic< CONF > |
| „backdoor“ to watch internals from tests | |
Private Member Functions | |
| Epoch & | firstEpoch () |
| Epoch & | lastEpoch () |
| EpochIter | allEpochs () |
| Time | updatePastDeadline (TimeVar newDeadline) |
| void | ___sanityCheckAlloc (size_t newBlockCnt) |
Private Member Functions inherited from NonCopyable | |
| ~NonCopyable ()=default | |
| NonCopyable ()=default | |
| NonCopyable (NonCopyable const &)=delete | |
| NonCopyable & | operator= (NonCopyable const &)=delete |
Static Private Member Functions | |
| static Epoch & | asEpoch (Extent &extent) |
Private Attributes | |
| Allocator | alloc_ |
| TimeVar | epochStep_ |
| TimeVar | pastDeadline_ {Time::ANYTIME} |
Static Private Attributes | |
| static constexpr size_t | EPOCH_SIZ = CONF::EPOCH_SIZ |
|
inline |
Definition at line 422 of file block-flow.hpp.
| using Allocator = mem::ExtentFamily<Activity, EPOCH_SIZ> |
Definition at line 348 of file block-flow.hpp.
| using Strategy = blockFlow::Strategy<CONF> |
Definition at line 349 of file block-flow.hpp.
| using RawIter = Allocator::iterator |
Definition at line 350 of file block-flow.hpp.
| using Extent = Allocator::Extent |
Definition at line 351 of file block-flow.hpp.
| using Epoch = blockFlow::Epoch<Allocator> |
Definition at line 352 of file block-flow.hpp.
| using EpochIter = lib::IterableDecorator<StorageAdaptor> |
Adapted storage-Extent iterator, directly exposing Epoch&.
Definition at line 444 of file block-flow.hpp.
|
inlinestaticprivate |
use a raw storage Extent as Epoch (unchecked cast)
Definition at line 363 of file block-flow.hpp.
Referenced by BlockFlow< CONF >::StorageAdaptor::accessEpoch(), BlockFlow< CONF >::firstEpoch(), and BlockFlow< CONF >::lastEpoch().
Here is the caller graph for this function:
|
inline |
Definition at line 428 of file block-flow.hpp.
References BlockFlow< CONF >::epochStep_.
Referenced by BlockFlow_test::adjustEpochs(), BlockFlow_test::announceLoad(), BlockFlow< CONF >::AllocatorHandle::claimSlot(), BlockFlow_test::placeActivity(), BlockFlow_test::simpleUsage(), and BlockFlow_test::storageFlow().
Here is the caller graph for this function:
|
inline |
Definition at line 434 of file block-flow.hpp.
References BlockFlow< CONF >::epochStep_.
Referenced by BlockFlow< CONF >::markEpochOverflow(), and BlockFlow< CONF >::markEpochUnderflow().
Here is the caller graph for this function:
|
inline |
initiate allocations for activities to happen until some deadline
Definition at line 516 of file block-flow.hpp.
References BlockFlow< CONF >::___sanityCheckAlloc(), BlockFlow< CONF >::alloc_, ExtentFamily< T, siz >::begin(), Epoch< ALO >::deadline(), ExtentFamily< T, siz >::end(), BlockFlow< CONF >::epochStep_, BlockFlow< CONF >::firstEpoch(), BlockFlow< CONF >::lastEpoch(), ExtentFamily< T, siz >::openNew(), and Epoch< ALO >::setup().
Referenced by ActivityLang::createTick(), BlockFlow_test::placeActivity(), ActivityLang::setupActivityScheme(), BlockFlow_test::simpleUsage(), and BlockFlow_test::storageFlow().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Clean-up all storage related to activities before the given deadline.
Definition at line 574 of file block-flow.hpp.
References BlockFlow< CONF >::allEpochs(), BlockFlow< CONF >::alloc_, ExtentFamily< T, siz >::dropOld(), BlockFlow< CONF >::firstEpoch(), BlockFlow< CONF >::markEpochUnderflow(), and BlockFlow< CONF >::updatePastDeadline().
Referenced by ActivityLang::discardBefore(), BlockFlow_test::placeActivity(), BlockFlow_test::simpleUsage(), and BlockFlow_test::storageFlow().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Notify and adjust Epoch capacity as consequence of exhausting an Epoch.
Whenever some Epoch can not accommodate a required allocation, the allocation is placed into subsequent Epoch(s) and then this event is triggered, reducing the epochStep_ by #OVERFLOW_BOOST_FACTOR to increase capacity.
Definition at line 602 of file block-flow.hpp.
References BlockFlow< CONF >::_cache_boostFactorOverflow, BlockFlow< CONF >::_cache_timeStep_cutOff, BlockFlow< CONF >::adjustEpochStep(), and BlockFlow< CONF >::epochStep_.
Referenced by BlockFlow_test::adjustEpochs(), and BlockFlow< CONF >::AllocatorHandle::claimSlot().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
On clean-up of past Epochs, the actual fill factor is checked to guess an Epoch duration to make optimal use of epoch storage.
Assuming that requested Activity deadlines are evenly spaced, for a simple heuristic we can just divide actual Epoch duration by the fill factor (longer Epoch => less capacity). To avoid control oscillations however, it seems prudent to use damping by an exponential moving average, nominally over Strategy::averageEpochs(). The current epochStep_ is assumed to be such a moving average, and will be updated accordingly.
Definition at line 622 of file block-flow.hpp.
References BlockFlow< CONF >::adjustEpochStep(), Strategy< CONF >::averageEpochs(), Strategy< CONF >::boostFactor(), BlockFlow< CONF >::config(), and BlockFlow< CONF >::epochStep_.
Referenced by BlockFlow_test::adjustEpochs(), and BlockFlow< CONF >::discardBefore().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
provide a hint to the self-regulating allocation scheme.
Signalling additional calculation flow in advance will immediately reduce the Epoch stepping to accommodate for more Activities per time unit, thereby preventing excessive overflow and reduced performance, until the mechanism has adapted itself to the actual situation after roughly 2sec.
Definition at line 652 of file block-flow.hpp.
References BlockFlow< CONF >::_cache_timeStep_cutOff, BlockFlow< CONF >::epochStep_, Strategy< CONF >::framesPerEpoch(), and util::max().
Referenced by BlockFlow_test::announceLoad(), and ActivityLang::announceLoad().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 663 of file block-flow.hpp.
References BlockFlow< CONF >::alloc_, BlockFlow< CONF >::asEpoch(), and ExtentFamily< T, siz >::begin().
Referenced by BlockFlow< CONF >::discardBefore(), FlowDiagnostic< CONF >::first(), and BlockFlow< CONF >::until().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 669 of file block-flow.hpp.
References BlockFlow< CONF >::alloc_, BlockFlow< CONF >::asEpoch(), and ExtentFamily< T, siz >::last().
Referenced by BlockFlow< CONF >::AllocatorHandle::claimSlot(), FlowDiagnostic< CONF >::last(), and BlockFlow< CONF >::until().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 676 of file block-flow.hpp.
References BlockFlow< CONF >::alloc_, and ExtentFamily< T, siz >::begin().
Referenced by FlowDiagnostic< CONF >::allEpochs(), FlowDiagnostic< CONF >::cntElm(), BlockFlow< CONF >::discardBefore(), and FlowDiagnostic< CONF >::find().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
helper to calculate the duration of the oldest Epoch.
| current | deadline of the oldest block, about to be discarded |
Definition at line 689 of file block-flow.hpp.
References Time::ANYTIME, BlockFlow< CONF >::epochStep_, and BlockFlow< CONF >::pastDeadline_.
Referenced by BlockFlow< CONF >::discardBefore().
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 700 of file block-flow.hpp.
References vault::gear::blockFlow::BLOCK_EXPAND_SAFETY_LIMIT, and util::showSize().
Referenced by BlockFlow< CONF >::until().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 157 of file block-flow.hpp.
Referenced by BlockFlow< CONF >::markEpochUnderflow().
Here is the caller graph for this function:
|
staticconstexprprivate |
Definition at line 345 of file block-flow.hpp.
|
private |
Definition at line 357 of file block-flow.hpp.
Referenced by BlockFlow< CONF >::allEpochs(), FlowDiagnostic< CONF >::allEpochs(), FlowDiagnostic< CONF >::cntEpochs(), BlockFlow< CONF >::discardBefore(), BlockFlow< CONF >::firstEpoch(), BlockFlow< CONF >::lastEpoch(), FlowDiagnostic< CONF >::poolSize(), and BlockFlow< CONF >::until().
|
private |
Definition at line 358 of file block-flow.hpp.
Referenced by BlockFlow< CONF >::adjustEpochStep(), BlockFlow< CONF >::announceAdditionalFlow(), BlockFlow< CONF >::getEpochStep(), BlockFlow< CONF >::markEpochOverflow(), BlockFlow< CONF >::markEpochUnderflow(), BlockFlow< CONF >::until(), and BlockFlow< CONF >::updatePastDeadline().
| Duration _cache_timeStep_cutOff = Strategy::timeStep_cutOff() |
Definition at line 608 of file block-flow.hpp.
Referenced by BlockFlow< CONF >::announceAdditionalFlow(), and BlockFlow< CONF >::markEpochOverflow().
| double _cache_boostFactorOverflow = Strategy::boostFactorOverflow() |
Definition at line 609 of file block-flow.hpp.
Referenced by BlockFlow< CONF >::markEpochOverflow().
|
private |
Definition at line 697 of file block-flow.hpp.
Referenced by BlockFlow< CONF >::updatePastDeadline().
|
friend |
„backdoor“ to watch internals from tests
Definition at line 700 of file block-flow.hpp.
Inheritance diagram for BlockFlow< CONF >:
Collaboration diagram for BlockFlow< CONF >: