Project
Loading...
Searching...
No Matches
o2::framework::TimesliceIndex Class Reference

#include <TimesliceIndex.h>

Classes

struct  ActionSpec
 The result of the replacing the LRU slot with a new one. More...
 
struct  OldestInputInfo
 
struct  OldestOutputInfo
 

Public Types

enum struct  BackpressureOp { Wait , DropAncient , DropRecent }
 What to do when there is backpressure. More...
 
enum struct  ActionTaken {
  ReplaceUnused , ReplaceObsolete , Wait , DropInvalid ,
  DropObsolete
}
 The outcome for the processing of a given timeslot. More...
 

Public Member Functions

 TimesliceIndex (size_t maxLanes, std::vector< InputChannelInfo > &channels)
 
void resize (size_t s)
 
size_t size () const
 
bool isValid (TimesliceSlot const &slot) const
 
bool isDirty (TimesliceSlot const &slot) const
 
void markAsDirty (TimesliceSlot slot, bool value)
 
void markAsInvalid (TimesliceSlot slot)
 
void rescan ()
 Mark all the cachelines as invalid, e.g. due to an out of band event.
 
void publishSlot (TimesliceSlot slot)
 Publish a slot to be sent via metrics.
 
void associate (TimesliceId timestamp, TimesliceSlot slot)
 
data_matcher::VariableContextgetVariablesForSlot (TimesliceSlot slot)
 
data_matcher::VariableContextgetPublishedVariablesForSlot (TimesliceSlot slot)
 
std::tuple< ActionTaken, TimesliceSlotreplaceLRUWith (data_matcher::VariableContext &newContext, TimesliceId timestamp)
 
bool didReceiveData () const
 
OldestInputInfo setOldestPossibleInput (TimesliceId timeslice, ChannelIndex channel)
 
bool validateSlot (TimesliceSlot slot, TimesliceId currentOldest)
 
OldestInputInfo getOldestPossibleInput () const
 
OldestOutputInfo getOldestPossibleOutput () const
 
OldestOutputInfo updateOldestPossibleOutput (bool rewinded)
 
InputChannelInfo const & getChannelInfo (ChannelIndex channel) const
 
auto reset () -> void
 

Static Public Attributes

static constexpr ServiceKind service_kind = ServiceKind::Global
 

Detailed Description

This class keeps the information relative to a given slot in the cache, in particular which variables are associated to it (and indirectly which timeslice which is always mapped to the variable 0) and wether we should consider the slot dirty (e.g. up for reprocessing by the completion policy). It also provides helpers to decide which slot to reuse in case we are under overload.

Definition at line 35 of file TimesliceIndex.h.

Member Enumeration Documentation

◆ ActionTaken

The outcome for the processing of a given timeslot.

Enumerator
ReplaceUnused 
ReplaceObsolete 

An unused / invalid slot is used to hold the new context.

Wait 

An obsolete slot is used to hold the new context and the old one is dropped.

DropInvalid 

We wait for the oldest slot to complete.

DropObsolete 

An invalid context is not inserted in the index and dropped.

An obsolete context is not inserted in the index and dropped

Definition at line 50 of file TimesliceIndex.h.

◆ BackpressureOp

What to do when there is backpressure.

Enumerator
Wait 
DropAncient 
DropRecent 

Definition at line 43 of file TimesliceIndex.h.

Constructor & Destructor Documentation

◆ TimesliceIndex()

o2::framework::TimesliceIndex::TimesliceIndex ( size_t  maxLanes,
std::vector< InputChannelInfo > &  channels 
)

Definition at line 20 of file TimesliceIndex.cxx.

Member Function Documentation

◆ associate()

void o2::framework::TimesliceIndex::associate ( TimesliceId  timestamp,
TimesliceSlot  slot 
)

Associated the timestamp to the given slot. Notice that now the information about the timeslot to associate needs to be determined outside the TimesliceIndex.

Definition at line 33 of file TimesliceIndex.cxx.

◆ didReceiveData()

bool o2::framework::TimesliceIndex::didReceiveData ( ) const
Returns
true if the device got some data.

Definition at line 121 of file TimesliceIndex.cxx.

◆ getChannelInfo()

InputChannelInfo const & o2::framework::TimesliceIndex::getChannelInfo ( ChannelIndex  channel) const

Definition at line 234 of file TimesliceIndex.cxx.

◆ getOldestPossibleInput()

OldestInputInfo o2::framework::TimesliceIndex::getOldestPossibleInput ( ) const

Find the lowest value for the timeslices in this instance. This is the minimum between all the per channel oldest possible timeslices and the oldest possible timeslice in-fly which is still dirty.

◆ getOldestPossibleOutput()

OldestOutputInfo o2::framework::TimesliceIndex::getOldestPossibleOutput ( ) const

◆ getPublishedVariablesForSlot()

data_matcher::VariableContext & o2::framework::TimesliceIndex::getPublishedVariablesForSlot ( TimesliceSlot  slot)
inline

Given a slot,

Returns
the VariableContext associated to it. This effectively means that the TimesliceIndex is now owner of the VariableContext.

◆ getVariablesForSlot()

data_matcher::VariableContext & o2::framework::TimesliceIndex::getVariablesForSlot ( TimesliceSlot  slot)
inline

Given a slot,

Returns
the VariableContext associated to it. This effectively means that the TimesliceIndex is now owner of the VariableContext.

◆ isDirty()

bool o2::framework::TimesliceIndex::isDirty ( TimesliceSlot const &  slot) const
inline

◆ isValid()

bool o2::framework::TimesliceIndex::isValid ( TimesliceSlot const &  slot) const
inline

◆ markAsDirty()

void o2::framework::TimesliceIndex::markAsDirty ( TimesliceSlot  slot,
bool  value 
)
inline

◆ markAsInvalid()

void o2::framework::TimesliceIndex::markAsInvalid ( TimesliceSlot  slot)
inline

◆ publishSlot()

void o2::framework::TimesliceIndex::publishSlot ( TimesliceSlot  slot)
inline

Publish a slot to be sent via metrics.

◆ replaceLRUWith()

std::tuple< TimesliceIndex::ActionTaken, TimesliceSlot > o2::framework::TimesliceIndex::replaceLRUWith ( data_matcher::VariableContext newContext,
TimesliceId  timestamp 
)

Find the LRU entry in the cache and replace it with newContext slot is filled with the slot used to hold the context, if applicable. timestamp must be provided to select the correct lane, in case of pipelining

Returns
the action taken on insertion, which can be used for bookkeeping of the messages.

Definition at line 68 of file TimesliceIndex.cxx.

◆ rescan()

void o2::framework::TimesliceIndex::rescan ( )
inline

Mark all the cachelines as invalid, e.g. due to an out of band event.

◆ reset()

auto o2::framework::TimesliceIndex::reset ( ) -> void

The actual channel id of the oldest input.

Definition at line 239 of file TimesliceIndex.cxx.

◆ resize()

void o2::framework::TimesliceIndex::resize ( size_t  s)

Definition at line 26 of file TimesliceIndex.cxx.

◆ setOldestPossibleInput()

TimesliceIndex::OldestInputInfo o2::framework::TimesliceIndex::setOldestPossibleInput ( TimesliceId  timeslice,
ChannelIndex  channel 
)

Set the older possible input per channel

Returns
the updated oldest possible input. Notice that this should be used with the validateSlots below to actually discard the slots.

Definition at line 141 of file TimesliceIndex.cxx.

◆ size()

size_t o2::framework::TimesliceIndex::size ( ) const
inline

◆ updateOldestPossibleOutput()

TimesliceIndex::OldestOutputInfo o2::framework::TimesliceIndex::updateOldestPossibleOutput ( bool  rewinded)

Definition at line 195 of file TimesliceIndex.cxx.

◆ validateSlot()

bool o2::framework::TimesliceIndex::validateSlot ( TimesliceSlot  slot,
TimesliceId  currentOldest 
)

Validate that the slot slot is still not older than currentOldest

Returns
true if the slot was not invalidated by the new currentOldest

Definition at line 181 of file TimesliceIndex.cxx.

Member Data Documentation

◆ service_kind

constexpr ServiceKind o2::framework::TimesliceIndex::service_kind = ServiceKind::Global
staticconstexpr

TimesliceIndex is threadsafe because it's accessed only by the DataRelayer.

Definition at line 40 of file TimesliceIndex.h.


The documentation for this class was generated from the following files: