gem5
v20.1.0.0
|
#include <MessageBuffer.hh>
Public Types | |
typedef MessageBufferParams | Params |
Public Types inherited from SimObject | |
typedef SimObjectParams | Params |
Public Member Functions | |
MessageBuffer (const Params *p) | |
void | reanalyzeMessages (Addr addr, Tick current_time) |
void | reanalyzeAllMessages (Tick current_time) |
void | stallMessage (Addr addr, Tick current_time) |
bool | hasStalledMsg (Addr addr) const |
bool | isReady (Tick current_time) const |
void | delayHead (Tick current_time, Tick delta) |
bool | areNSlotsAvailable (unsigned int n, Tick curTime) |
int | getPriority () |
void | setPriority (int rank) |
void | setConsumer (Consumer *consumer) |
Consumer * | getConsumer () |
bool | getOrdered () |
const Message * | peek () const |
Function for extracting the message at the head of the message queue. More... | |
const MsgPtr & | peekMsgPtr () const |
void | enqueue (MsgPtr message, Tick curTime, Tick delta) |
void | deferEnqueueingMessage (Addr addr, MsgPtr message) |
void | enqueueDeferredMessages (Addr addr, Tick curTime, Tick delay) |
bool | isDeferredMsgMapEmpty (Addr addr) const |
Tick | dequeue (Tick current_time, bool decrement_messages=true) |
Updates the delay cycles of the message at the head of the queue, removes it from the queue and returns its total delay. More... | |
void | registerDequeueCallback (std::function< void()> callback) |
void | unregisterDequeueCallback () |
void | recycle (Tick current_time, Tick recycle_latency) |
bool | isEmpty () const |
bool | isStallMapEmpty () |
unsigned int | getStallMapSize () |
unsigned int | getSize (Tick curTime) |
void | clear () |
void | print (std::ostream &out) const |
void | clearStats () |
void | setIncomingLink (int link_id) |
void | setVnet (int net) |
Port & | getPort (const std::string &, PortID idx=InvalidPortID) override |
Get a port with a given name and index. More... | |
void | regStats () override |
Callback to set stat parameters. More... | |
uint32_t | functionalWrite (Packet *pkt) |
bool | functionalRead (Packet *pkt) |
Public Member Functions inherited from SimObject | |
const Params * | params () const |
SimObject (const Params *_params) | |
virtual | ~SimObject () |
virtual const std::string | name () const |
virtual void | init () |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
virtual void | loadState (CheckpointIn &cp) |
loadState() is called on each SimObject when restoring from a checkpoint. More... | |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. More... | |
virtual void | regProbePoints () |
Register probe points for this object. More... | |
virtual void | regProbeListeners () |
Register probe listeners for this object. More... | |
ProbeManager * | getProbeManager () |
Get the probe manager for this object. More... | |
virtual void | startup () |
startup() is the final initialization call before simulation. More... | |
DrainState | drain () override |
Provide a default implementation of the drain interface for objects that don't need draining. More... | |
virtual void | memWriteback () |
Write back dirty buffers to memory using functional writes. More... | |
virtual void | memInvalidate () |
Invalidate the contents of memory buffers. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Public Member Functions inherited from EventManager | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More... | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. More... | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
Public Member Functions inherited from Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Member Functions inherited from Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
Public Member Functions inherited from Stats::Group | |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. More... | |
virtual | ~Group () |
virtual void | resetStats () |
Callback to reset stats. More... | |
virtual void | preDumpStats () |
Callback before stats are dumped. More... | |
void | addStat (Stats::Info *info) |
Register a stat with this group. More... | |
const std::map< std::string, Group * > & | getStatGroups () const |
Get all child groups associated with this object. More... | |
const std::vector< Info * > & | getStats () const |
Get all stats associated with this object. More... | |
void | addStatGroup (const char *name, Group *block) |
Add a stat block as a child of this block. More... | |
const Info * | resolveStat (std::string name) const |
Resolve a stat by its name within this group. More... | |
Group ()=delete | |
Group (const Group &)=delete | |
Group & | operator= (const Group &)=delete |
Private Types | |
typedef std::map< Addr, std::list< MsgPtr > > | StallMsgMapType |
typedef std::unordered_map< Addr, std::vector< MsgPtr > > | DeferredMsgMapType |
A map from line addresses to corresponding vectors of messages that are deferred for enqueueing. More... | |
Private Member Functions | |
void | reanalyzeList (std::list< MsgPtr > &, Tick) |
uint32_t | functionalAccess (Packet *pkt, bool is_read) |
Private Attributes | |
Consumer * | m_consumer |
Consumer to signal a wakeup(), can be NULL. More... | |
std::vector< MsgPtr > | m_prio_heap |
std::function< void()> | m_dequeue_callback |
StallMsgMapType | m_stall_msg_map |
A map from line addresses to lists of stalled messages for that line. More... | |
DeferredMsgMapType | m_deferred_msg_map |
int | m_stall_map_size |
Current size of the stall map. More... | |
const unsigned int | m_max_size |
The maximum capacity. More... | |
Tick | m_time_last_time_size_checked |
unsigned int | m_size_last_time_size_checked |
Tick | m_time_last_time_enqueue |
Tick | m_time_last_time_pop |
Tick | m_last_arrival_time |
unsigned int | m_size_at_cycle_start |
unsigned int | m_stalled_at_cycle_start |
unsigned int | m_msgs_this_cycle |
Stats::Scalar | m_not_avail_count |
uint64_t | m_msg_counter |
int | m_priority_rank |
const bool | m_strict_fifo |
const bool | m_randomization |
int | m_input_link_id |
int | m_vnet_id |
Stats::Average | m_buf_msgs |
Stats::Average | m_stall_time |
Stats::Scalar | m_stall_count |
Stats::Formula | m_occupancy |
Additional Inherited Members | |
Static Public Member Functions inherited from SimObject | |
static void | serializeAll (CheckpointOut &cp) |
Serialize all SimObjects in the system. More... | |
static SimObject * | find (const char *name) |
Find the SimObject with the given name and return a pointer to it. More... | |
Static Public Member Functions inherited from Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
Serializes all the SimObjects. More... | |
static void | unserializeGlobals (CheckpointIn &cp) |
Protected Member Functions inherited from Drainable | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. More... | |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
Protected Attributes inherited from SimObject | |
const SimObjectParams * | _params |
Cached copy of the object parameters. More... | |
Protected Attributes inherited from EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Definition at line 68 of file MessageBuffer.hh.
|
private |
A map from line addresses to corresponding vectors of messages that are deferred for enqueueing.
Messages in this map are waiting to be enqueued into the message buffer.
Definition at line 214 of file MessageBuffer.hh.
typedef MessageBufferParams MessageBuffer::Params |
Definition at line 71 of file MessageBuffer.hh.
|
private |
Definition at line 192 of file MessageBuffer.hh.
MessageBuffer::MessageBuffer | ( | const Params * | p | ) |
Definition at line 55 of file MessageBuffer.cc.
References m_buf_msgs, m_consumer, m_dequeue_callback, m_input_link_id, m_msg_counter, m_msgs_this_cycle, m_priority_rank, m_size_at_cycle_start, m_size_last_time_size_checked, m_stall_msg_map, m_stall_time, m_stalled_at_cycle_start, and m_vnet_id.
bool MessageBuffer::areNSlotsAvailable | ( | unsigned int | n, |
Tick | curTime | ||
) |
Definition at line 92 of file MessageBuffer.cc.
References DPRINTF, m_max_size, m_msgs_this_cycle, m_not_avail_count, m_prio_heap, m_size_at_cycle_start, m_stall_map_size, m_stalled_at_cycle_start, m_time_last_time_enqueue, m_time_last_time_pop, and ArmISA::n.
Referenced by Throttle::operateVnet().
void MessageBuffer::clear | ( | ) |
Definition at line 289 of file MessageBuffer.cc.
References m_msg_counter, m_msgs_this_cycle, m_prio_heap, m_size_at_cycle_start, m_stalled_at_cycle_start, m_time_last_time_enqueue, and m_time_last_time_pop.
|
inline |
Definition at line 147 of file MessageBuffer.hh.
References m_msg_counter, and m_not_avail_count.
Definition at line 404 of file MessageBuffer.cc.
References addr, DPRINTF, and m_deferred_msg_map.
Definition at line 84 of file MessageBuffer.hh.
References enqueue(), ArmISA::m, and m_prio_heap.
Updates the delay cycles of the message at the head of the queue, removes it from the queue and returns its total delay.
Definition at line 238 of file MessageBuffer.cc.
References curTick(), DPRINTF, isReady(), m_buf_msgs, m_dequeue_callback, m_prio_heap, m_size_at_cycle_start, m_stall_map_size, m_stall_time, m_stalled_at_cycle_start, and m_time_last_time_pop.
Referenced by PerfectSwitch::operateMessageBuffer(), Throttle::operateVnet(), and stallMessage().
Definition at line 162 of file MessageBuffer.cc.
References DPRINTF, Message::getLastEnqueueTime(), RubySystem::getRandomization(), RubySystem::getWarmupEnabled(), m_buf_msgs, m_consumer, m_last_arrival_time, m_msg_counter, m_msgs_this_cycle, m_prio_heap, m_randomization, m_strict_fifo, m_time_last_time_enqueue, m_vnet_id, SimObject::name(), panic, random_time(), Consumer::scheduleEventAbsolute(), Message::setLastEnqueueTime(), Message::setMsgCounter(), Consumer::storeEventInfo(), and Message::updateDelayedTicks().
Referenced by delayHead(), enqueueDeferredMessages(), VIPERCoalescer::invTCP(), DMASequencer::issueNext(), VIPERCoalescer::issueRequest(), Sequencer::issueRequest(), DMASequencer::makeRequest(), Throttle::operateVnet(), and AbstractController::recvTimingResp().
Definition at line 412 of file MessageBuffer.cc.
References addr, enqueue(), isDeferredMsgMapEmpty(), ArmISA::m, and m_deferred_msg_map.
|
private |
Definition at line 489 of file MessageBuffer.cc.
References DPRINTF, Message::functionalRead(), Message::functionalWrite(), Packet::getAddr(), ArmISA::i, m_prio_heap, and m_stall_msg_map.
Referenced by functionalRead(), and functionalWrite().
|
inline |
Definition at line 172 of file MessageBuffer.hh.
References functionalAccess().
|
inline |
Definition at line 163 of file MessageBuffer.hh.
References functionalAccess().
|
inline |
Definition at line 107 of file MessageBuffer.hh.
References m_consumer.
|
inline |
Definition at line 109 of file MessageBuffer.hh.
References m_strict_fifo.
|
inlineoverridevirtual |
Get a port with a given name and index.
This is used at binding time and returns a reference to a protocol-agnostic port.
gem5 has a request and response port interface. All memory objects are connected together via ports. These ports provide a rigid interface between these memory objects. These ports implement three different memory system modes: timing, atomic, and functional. The most important mode is the timing mode and here timing mode is used for conducting cycle-level timing experiments. The other modes are only used in special circumstances and should not be used to conduct cycle-level timing experiments. The other modes are only used in special circumstances. These ports allow SimObjects to communicate with each other.
if_name | Port name |
idx | Index in the case of a VectorPort |
Reimplemented from SimObject.
Definition at line 153 of file MessageBuffer.hh.
References RubyDummyPort::instance().
|
inline |
Definition at line 94 of file MessageBuffer.hh.
References m_priority_rank.
unsigned int MessageBuffer::getSize | ( | Tick | curTime | ) |
Definition at line 81 of file MessageBuffer.cc.
References m_prio_heap, m_size_last_time_size_checked, and m_time_last_time_size_checked.
|
inline |
Definition at line 141 of file MessageBuffer.hh.
References m_stall_msg_map.
bool MessageBuffer::hasStalledMsg | ( | Addr | addr | ) | const |
Definition at line 398 of file MessageBuffer.cc.
References addr, and m_stall_msg_map.
bool MessageBuffer::isDeferredMsgMapEmpty | ( | Addr | addr | ) | const |
Definition at line 428 of file MessageBuffer.cc.
References addr, and m_deferred_msg_map.
Referenced by enqueueDeferredMessages().
|
inline |
Definition at line 139 of file MessageBuffer.hh.
References m_prio_heap.
bool MessageBuffer::isReady | ( | Tick | current_time | ) | const |
Definition at line 447 of file MessageBuffer.cc.
References m_prio_heap.
Referenced by dequeue(), PerfectSwitch::operateMessageBuffer(), Throttle::operateVnet(), recycle(), and stallMessage().
|
inline |
Definition at line 140 of file MessageBuffer.hh.
References m_stall_msg_map.
const Message * MessageBuffer::peek | ( | ) | const |
Function for extracting the message at the head of the message queue.
The function assumes that the queue is nonempty.
Definition at line 139 of file MessageBuffer.cc.
References DPRINTF, and m_prio_heap.
|
inline |
Definition at line 115 of file MessageBuffer.hh.
References m_prio_heap.
Referenced by PerfectSwitch::operateMessageBuffer(), and Throttle::operateVnet().
void MessageBuffer::print | ( | std::ostream & | out | ) | const |
Definition at line 434 of file MessageBuffer.cc.
References ccprintf(), m_consumer, m_prio_heap, and SimObject::name().
Referenced by operator<<().
void MessageBuffer::reanalyzeAllMessages | ( | Tick | current_time | ) |
Definition at line 356 of file MessageBuffer.cc.
References DPRINTF, m_stall_map_size, m_stall_msg_map, and reanalyzeList().
Definition at line 318 of file MessageBuffer.cc.
References DPRINTF, PowerISA::lt, ArmISA::m, m_consumer, m_prio_heap, and Consumer::scheduleEventAbsolute().
Referenced by reanalyzeAllMessages(), and reanalyzeMessages().
Definition at line 338 of file MessageBuffer.cc.
References addr, DPRINTF, m_stall_map_size, m_stall_msg_map, and reanalyzeList().
Definition at line 302 of file MessageBuffer.cc.
References DPRINTF, isReady(), m_consumer, m_prio_heap, and Consumer::scheduleEventAbsolute().
void MessageBuffer::registerDequeueCallback | ( | std::function< void()> | callback | ) |
Definition at line 277 of file MessageBuffer.cc.
References m_dequeue_callback.
|
overridevirtual |
Callback to set stat parameters.
This callback is typically used for complex stats (e.g., distributions) that need parameters in addition to a name and a description. Stat names and descriptions should typically be set from the constructor usingo from the constructor using the ADD_STAT macro.
Reimplemented from Stats::Group.
Definition at line 454 of file MessageBuffer.cc.
References Stats::DataWrap< Derived, InfoProxyType >::desc(), Stats::DataWrap< Derived, InfoProxyType >::flags(), m_buf_msgs, m_max_size, m_not_avail_count, m_occupancy, m_stall_count, m_stall_time, SimObject::name(), Stats::DataWrap< Derived, InfoProxyType >::name(), and Stats::nozero.
|
inline |
Definition at line 96 of file MessageBuffer.hh.
References DPRINTF, fatal, and m_consumer.
Referenced by Throttle::addLinks(), and AbstractController::init().
|
inline |
Definition at line 149 of file MessageBuffer.hh.
References m_input_link_id.
|
inline |
Definition at line 95 of file MessageBuffer.hh.
References m_priority_rank.
|
inline |
Definition at line 150 of file MessageBuffer.hh.
References m_vnet_id.
Definition at line 376 of file MessageBuffer.cc.
References addr, dequeue(), DPRINTF, getOffset(), isReady(), m_prio_heap, m_stall_count, m_stall_map_size, and m_stall_msg_map.
void MessageBuffer::unregisterDequeueCallback | ( | ) |
Definition at line 283 of file MessageBuffer.cc.
References m_dequeue_callback.
|
private |
Definition at line 256 of file MessageBuffer.hh.
Referenced by dequeue(), enqueue(), MessageBuffer(), and regStats().
|
private |
Consumer to signal a wakeup(), can be NULL.
Definition at line 185 of file MessageBuffer.hh.
Referenced by enqueue(), getConsumer(), MessageBuffer(), print(), reanalyzeList(), recycle(), and setConsumer().
|
private |
Definition at line 215 of file MessageBuffer.hh.
Referenced by deferEnqueueingMessage(), enqueueDeferredMessages(), and isDeferredMsgMapEmpty().
|
private |
Definition at line 188 of file MessageBuffer.hh.
Referenced by dequeue(), MessageBuffer(), registerDequeueCallback(), and unregisterDequeueCallback().
|
private |
Definition at line 253 of file MessageBuffer.hh.
Referenced by MessageBuffer(), and setIncomingLink().
|
private |
Definition at line 240 of file MessageBuffer.hh.
Referenced by enqueue().
|
private |
The maximum capacity.
For finite-sized buffers, m_max_size stores a number greater than 0 to indicate the maximum allowed number of messages in the buffer at any time. To get infinitely-sized buffers, set buffer size: m_max_size = 0
Definition at line 231 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), and regStats().
|
private |
Definition at line 248 of file MessageBuffer.hh.
Referenced by clear(), clearStats(), enqueue(), and MessageBuffer().
|
private |
Definition at line 244 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), clear(), enqueue(), and MessageBuffer().
|
private |
Definition at line 246 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), clearStats(), and regStats().
|
private |
Definition at line 259 of file MessageBuffer.hh.
Referenced by regStats().
|
private |
Definition at line 186 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), clear(), delayHead(), dequeue(), enqueue(), functionalAccess(), getSize(), isEmpty(), isReady(), peek(), peekMsgPtr(), print(), reanalyzeList(), recycle(), and stallMessage().
|
private |
Definition at line 249 of file MessageBuffer.hh.
Referenced by getPriority(), MessageBuffer(), and setPriority().
|
private |
Definition at line 251 of file MessageBuffer.hh.
Referenced by enqueue().
|
private |
Definition at line 242 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), clear(), dequeue(), and MessageBuffer().
|
private |
Definition at line 234 of file MessageBuffer.hh.
Referenced by getSize(), and MessageBuffer().
|
private |
Definition at line 258 of file MessageBuffer.hh.
Referenced by regStats(), and stallMessage().
|
private |
Current size of the stall map.
Track the number of messages held in stall map lists. This is used to ensure that if the buffer is finite-sized, it blocks further requests when the m_prio_heap and m_stall_msg_map contain m_max_size messages.
Definition at line 223 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), dequeue(), reanalyzeAllMessages(), reanalyzeMessages(), and stallMessage().
|
private |
A map from line addresses to lists of stalled messages for that line.
If this buffer allows the receiver to stall messages, on a stall request, the stalled message is removed from the m_prio_heap and placed in the m_stall_msg_map. Messages are held there until the receiver requests they be reanalyzed, at which point they are moved back to m_prio_heap.
NOTE: The stall map holds messages in the order in which they were initially received, and when a line is unblocked, the messages are moved back to the m_prio_heap in the same order. This prevents starving older requests with younger ones.
Definition at line 207 of file MessageBuffer.hh.
Referenced by functionalAccess(), getStallMapSize(), hasStalledMsg(), isStallMapEmpty(), MessageBuffer(), reanalyzeAllMessages(), reanalyzeMessages(), and stallMessage().
|
private |
Definition at line 257 of file MessageBuffer.hh.
Referenced by dequeue(), MessageBuffer(), and regStats().
|
private |
Definition at line 243 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), clear(), dequeue(), and MessageBuffer().
|
private |
Definition at line 250 of file MessageBuffer.hh.
Referenced by enqueue(), and getOrdered().
|
private |
Definition at line 238 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), clear(), and enqueue().
|
private |
Definition at line 239 of file MessageBuffer.hh.
Referenced by areNSlotsAvailable(), clear(), and dequeue().
|
private |
Definition at line 233 of file MessageBuffer.hh.
Referenced by getSize().
|
private |
Definition at line 254 of file MessageBuffer.hh.
Referenced by enqueue(), MessageBuffer(), and setVnet().