gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MessageBuffer Class Reference

#include <MessageBuffer.hh>

Inheritance diagram for MessageBuffer:
SimObject EventManager Serializable Drainable

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 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)
 
ConsumergetConsumer ()
 
bool getOrdered ()
 
const Messagepeek () const
 Function for extracting the message at the head of the message queue. More...
 
const MsgPtrpeekMsgPtr () const
 
void enqueue (MsgPtr message, Tick curTime, Tick delta)
 
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)
 
void regStats ()
 Register statistics for this object. More...
 
uint32_t functionalWrite (Packet *pkt)
 
- Public Member Functions inherited from SimObject
const Paramsparams () 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 resetStats ()
 Reset statistics associated with this object. More...
 
virtual void regProbePoints ()
 Register probe points for this object. More...
 
virtual void regProbeListeners ()
 Register probe listeners for this object. More...
 
ProbeManagergetProbeManager ()
 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
 EventManager (EventManager &em)
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
EventQueueeventQueue () 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)
 
void setCurTick (Tick newVal)
 
- 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...
 

Private Types

typedef std::map< Addr,
std::list< MsgPtr > > 
StallMsgMapType
 

Private Member Functions

void reanalyzeList (std::list< MsgPtr > &, Tick)
 

Private Attributes

Consumerm_consumer
 Consumer to signal a wakeup(), can be NULL. More...
 
std::vector< MsgPtrm_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...
 
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_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 SimObjectfind (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 ()
 Get the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 
static void unserializeGlobals (CheckpointIn &cp)
 
- Static Public Attributes inherited from Serializable
static int ckptCount = 0
 
static int ckptMaxCount = 0
 
static int ckptPrevCount = -1
 
- 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
EventQueueeventq
 A pointer to this object's event queue. More...
 

Detailed Description

Definition at line 53 of file MessageBuffer.hh.

Member Typedef Documentation

typedef MessageBufferParams MessageBuffer::Params

Definition at line 56 of file MessageBuffer.hh.

typedef std::map<Addr, std::list<MsgPtr> > MessageBuffer::StallMsgMapType
private

Definition at line 144 of file MessageBuffer.hh.

Constructor & Destructor Documentation

MessageBuffer::MessageBuffer ( const Params p)

Member Function Documentation

bool MessageBuffer::areNSlotsAvailable ( unsigned int  n,
Tick  curTime 
)
void MessageBuffer::clear ( )
void MessageBuffer::clearStats ( )
inline

Definition at line 118 of file MessageBuffer.hh.

References m_msg_counter, and m_not_avail_count.

void MessageBuffer::delayHead ( Tick  current_time,
Tick  delta 
)
inline

Definition at line 67 of file MessageBuffer.hh.

References enqueue(), ArmISA::m, and m_prio_heap.

Tick MessageBuffer::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.

Definition at line 217 of file MessageBuffer.cc.

References curTick(), DPRINTF, isReady(), m_buf_msgs, m_dequeue_callback, m_prio_heap, m_size_at_cycle_start, m_stall_time, and m_time_last_time_pop.

Referenced by PerfectSwitch::operateMessageBuffer(), Throttle::operateVnet(), stallMessage(), and NetworkInterface::wakeup().

void MessageBuffer::enqueue ( MsgPtr  message,
Tick  curTime,
Tick  delta 
)
uint32_t MessageBuffer::functionalWrite ( Packet pkt)

Definition at line 428 of file MessageBuffer.cc.

References Message::functionalWrite(), ArmISA::i, m_prio_heap, and m_stall_msg_map.

Consumer* MessageBuffer::getConsumer ( )
inline

Definition at line 90 of file MessageBuffer.hh.

References m_consumer.

bool MessageBuffer::getOrdered ( )
inline

Definition at line 92 of file MessageBuffer.hh.

References m_strict_fifo.

int MessageBuffer::getPriority ( )
inline

Definition at line 77 of file MessageBuffer.hh.

References m_priority_rank.

unsigned int MessageBuffer::getSize ( Tick  curTime)
unsigned int MessageBuffer::getStallMapSize ( )
inline

Definition at line 112 of file MessageBuffer.hh.

References m_stall_msg_map.

bool MessageBuffer::isEmpty ( ) const
inline

Definition at line 110 of file MessageBuffer.hh.

References m_prio_heap.

bool MessageBuffer::isReady ( Tick  current_time) const
bool MessageBuffer::isStallMapEmpty ( )
inline

Definition at line 111 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 120 of file MessageBuffer.cc.

References DPRINTF, and m_prio_heap.

const MsgPtr& MessageBuffer::peekMsgPtr ( ) const
inline
void MessageBuffer::print ( std::ostream &  out) const

Definition at line 373 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 331 of file MessageBuffer.cc.

References DPRINTF, m_stall_map_size, m_stall_msg_map, and reanalyzeList().

void MessageBuffer::reanalyzeList ( std::list< MsgPtr > &  lt,
Tick  schdTick 
)
private
void MessageBuffer::reanalyzeMessages ( Addr  addr,
Tick  current_time 
)

Definition at line 313 of file MessageBuffer.cc.

References addr, DPRINTF, m_stall_map_size, m_stall_msg_map, and reanalyzeList().

void MessageBuffer::recycle ( Tick  current_time,
Tick  recycle_latency 
)
void MessageBuffer::registerDequeueCallback ( std::function< void()>  callback)

Definition at line 255 of file MessageBuffer.cc.

References m_dequeue_callback.

void MessageBuffer::regStats ( )
virtual
void MessageBuffer::setConsumer ( Consumer consumer)
inline

Definition at line 79 of file MessageBuffer.hh.

References DPRINTF, fatal, and m_consumer.

Referenced by Throttle::addLinks().

void MessageBuffer::setIncomingLink ( int  link_id)
inline

Definition at line 120 of file MessageBuffer.hh.

References m_input_link_id.

void MessageBuffer::setPriority ( int  rank)
inline

Definition at line 78 of file MessageBuffer.hh.

References m_priority_rank.

void MessageBuffer::setVnet ( int  net)
inline

Definition at line 121 of file MessageBuffer.hh.

References m_vnet_id.

void MessageBuffer::stallMessage ( Addr  addr,
Tick  current_time 
)
void MessageBuffer::unregisterDequeueCallback ( )

Definition at line 261 of file MessageBuffer.cc.

References m_dequeue_callback.

Member Data Documentation

Stats::Average MessageBuffer::m_buf_msgs
private

Definition at line 199 of file MessageBuffer.hh.

Referenced by dequeue(), enqueue(), MessageBuffer(), and regStats().

Consumer* MessageBuffer::m_consumer
private

Consumer to signal a wakeup(), can be NULL.

Definition at line 137 of file MessageBuffer.hh.

Referenced by enqueue(), getConsumer(), MessageBuffer(), print(), reanalyzeList(), recycle(), and setConsumer().

std::function<void()> MessageBuffer::m_dequeue_callback
private
int MessageBuffer::m_input_link_id
private

Definition at line 196 of file MessageBuffer.hh.

Referenced by MessageBuffer(), and setIncomingLink().

Tick MessageBuffer::m_last_arrival_time
private

Definition at line 184 of file MessageBuffer.hh.

Referenced by enqueue().

const unsigned int MessageBuffer::m_max_size
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 175 of file MessageBuffer.hh.

Referenced by areNSlotsAvailable(), and regStats().

uint64_t MessageBuffer::m_msg_counter
private

Definition at line 191 of file MessageBuffer.hh.

Referenced by clear(), clearStats(), enqueue(), MessageBuffer(), and reanalyzeList().

unsigned int MessageBuffer::m_msgs_this_cycle
private

Definition at line 187 of file MessageBuffer.hh.

Referenced by areNSlotsAvailable(), clear(), enqueue(), and MessageBuffer().

Stats::Scalar MessageBuffer::m_not_avail_count
private

Definition at line 189 of file MessageBuffer.hh.

Referenced by areNSlotsAvailable(), clearStats(), and regStats().

Stats::Formula MessageBuffer::m_occupancy
private

Definition at line 202 of file MessageBuffer.hh.

Referenced by regStats().

std::vector<MsgPtr> MessageBuffer::m_prio_heap
private
int MessageBuffer::m_priority_rank
private

Definition at line 192 of file MessageBuffer.hh.

Referenced by getPriority(), MessageBuffer(), and setPriority().

const bool MessageBuffer::m_randomization
private

Definition at line 194 of file MessageBuffer.hh.

Referenced by enqueue().

unsigned int MessageBuffer::m_size_at_cycle_start
private

Definition at line 186 of file MessageBuffer.hh.

Referenced by areNSlotsAvailable(), clear(), dequeue(), and MessageBuffer().

unsigned int MessageBuffer::m_size_last_time_size_checked
private

Definition at line 178 of file MessageBuffer.hh.

Referenced by getSize(), and MessageBuffer().

Stats::Scalar MessageBuffer::m_stall_count
private

Definition at line 201 of file MessageBuffer.hh.

Referenced by regStats(), and stallMessage().

int MessageBuffer::m_stall_map_size
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 167 of file MessageBuffer.hh.

Referenced by areNSlotsAvailable(), reanalyzeAllMessages(), reanalyzeMessages(), and stallMessage().

StallMsgMapType MessageBuffer::m_stall_msg_map
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 159 of file MessageBuffer.hh.

Referenced by functionalWrite(), getStallMapSize(), isStallMapEmpty(), MessageBuffer(), reanalyzeAllMessages(), reanalyzeMessages(), and stallMessage().

Stats::Average MessageBuffer::m_stall_time
private

Definition at line 200 of file MessageBuffer.hh.

Referenced by dequeue(), MessageBuffer(), and regStats().

const bool MessageBuffer::m_strict_fifo
private

Definition at line 193 of file MessageBuffer.hh.

Referenced by enqueue(), and getOrdered().

Tick MessageBuffer::m_time_last_time_enqueue
private

Definition at line 182 of file MessageBuffer.hh.

Referenced by areNSlotsAvailable(), clear(), and enqueue().

Tick MessageBuffer::m_time_last_time_pop
private

Definition at line 183 of file MessageBuffer.hh.

Referenced by areNSlotsAvailable(), clear(), and dequeue().

Tick MessageBuffer::m_time_last_time_size_checked
private

Definition at line 177 of file MessageBuffer.hh.

Referenced by getSize().

int MessageBuffer::m_vnet_id
private

Definition at line 197 of file MessageBuffer.hh.

Referenced by enqueue(), MessageBuffer(), and setVnet().


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

Generated on Fri Jun 9 2017 13:04:15 for gem5 by doxygen 1.8.6