Go to the documentation of this file.
49 #include "debug/RubyQueue.hh"
53 using m5::stl_helpers::operator<<;
57 m_max_size(
p->buffer_size), m_time_last_time_size_checked(0),
58 m_time_last_time_enqueue(0), m_time_last_time_pop(0),
59 m_last_arrival_time(0), m_strict_fifo(
p->ordered),
60 m_randomization(
p->randomization)
104 unsigned int current_size = 0;
105 unsigned int current_stall_size = 0;
126 if (current_size + current_stall_size +
n <=
m_max_size) {
129 DPRINTF(RubyQueue,
"n: %d, current_size: %d, heap size: %d, "
131 n, current_size + current_stall_size,
141 DPRINTF(RubyQueue,
"Peeking at head of queue.\n");
145 DPRINTF(RubyQueue,
"Message: %s\n", (*msg_ptr));
176 Tick arrival_time = 0;
182 arrival_time = current_time + delta;
196 assert(arrival_time > current_time);
199 panic(
"FIFO ordering violated: %s name: %s current time: %d "
200 "delta: %d arrival_time: %d last arrival_time: %d\n",
201 *
this,
name(), current_time, delta, arrival_time,
212 Message* msg_ptr = message.get();
213 assert(msg_ptr != NULL);
216 "ensure we aren't dequeued early");
228 DPRINTF(RubyQueue,
"Enqueue arrival_time: %lld, Message: %s\n",
229 arrival_time, *(message.get()));
240 DPRINTF(RubyQueue,
"Popping\n");
247 message->updateDelayedTicks(current_time);
248 Tick delay = message->getDelayedTicks();
262 if (decrement_messages) {
304 DPRINTF(RubyQueue,
"Recycling.\n");
309 Tick future_time = current_time + recycle_latency;
310 node->setLastEnqueueTime(future_time);
320 while (!
lt.empty()) {
322 assert(
m->getLastEnqueueTime() <= schdTick);
330 DPRINTF(RubyQueue,
"Requeue arrival_time: %lld, Message: %s\n",
331 schdTick, *(
m.get()));
340 DPRINTF(RubyQueue,
"ReanalyzeMessages %#x\n",
addr);
358 DPRINTF(RubyQueue,
"ReanalyzeAllMessages\n");
406 DPRINTF(RubyQueue,
"Deferring enqueueing message: %s, Address %#x\n",
407 *(message.get()),
addr);
416 assert(msg_vec.size() > 0);
442 sort_heap(copy.begin(), copy.end(), greater<MsgPtr>());
450 (
m_prio_heap.front()->getLastEnqueueTime() <= current_time));
458 .
desc(
"Number of times this buffer did not have N slots available")
463 .
desc(
"Average number of messages in buffer")
468 .
desc(
"Number of times messages were stalled")
473 .
desc(
"Average occupancy of buffer capacity")
478 .
desc(
"Average number of cycles messages are stalled in this MB")
491 DPRINTF(RubyQueue,
"functional %s for %#x\n",
492 is_read ?
"read" :
"write", pkt->
getAddr());
494 uint32_t num_functional_accesses = 0;
503 num_functional_accesses++;
513 it != (map_iter->second).end(); ++it) {
519 num_functional_accesses++;
523 return num_functional_accesses;
527 MessageBufferParams::create()
unsigned int m_msgs_this_cycle
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 retur...
Tick getLastEnqueueTime() const
Stats::Average m_stall_time
uint32_t functionalAccess(Packet *pkt, bool is_read)
const Message * peek() const
Function for extracting the message at the head of the message queue.
unsigned int m_size_at_cycle_start
std::function< void()> m_dequeue_callback
DeferredMsgMapType m_deferred_msg_map
uint64_t Tick
Tick count type.
unsigned int getSize(Tick curTime)
void reanalyzeMessages(Addr addr, Tick current_time)
Tick m_time_last_time_pop
void stallMessage(Addr addr, Tick current_time)
void enqueue(MsgPtr message, Tick curTime, Tick delta)
void regStats() override
Callback to set stat parameters.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
void updateDelayedTicks(Tick curTime)
Update the delay this message has experienced so far.
std::vector< MsgPtr > m_prio_heap
const unsigned int m_max_size
The maximum capacity.
void deferEnqueueingMessage(Addr addr, MsgPtr message)
Tick m_time_last_time_enqueue
unsigned int m_stalled_at_cycle_start
bool isReady(Tick current_time) const
bool isDeferredMsgMapEmpty(Addr addr) const
void reanalyzeAllMessages(Tick current_time)
bool hasStalledMsg(Addr addr) const
Stats::Scalar m_not_avail_count
unsigned int m_size_last_time_size_checked
Consumer * m_consumer
Consumer to signal a wakeup(), can be NULL.
void unregisterDequeueCallback()
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
MessageBuffer(const Params *p)
int m_stall_map_size
Current size of the stall map.
MessageBufferParams Params
std::shared_ptr< Message > MsgPtr
bool areNSlotsAvailable(unsigned int n, Tick curTime)
const FlagsType nozero
Don't print if this is zero.
void recycle(Tick current_time, Tick recycle_latency)
void registerDequeueCallback(std::function< void()> callback)
virtual const std::string name() const
void print(std::ostream &out) const
void setLastEnqueueTime(const Tick &time)
void scheduleEventAbsolute(Tick timeAbs)
Overload hash function for BasicBlockRange type.
static bool getWarmupEnabled()
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Addr getOffset(Addr addr)
void reanalyzeList(std::list< MsgPtr > &, Tick)
void ccprintf(cp::Print &print)
Stats::Formula m_occupancy
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
void enqueueDeferredMessages(Addr addr, Tick curTime, Tick delay)
const bool m_randomization
static int getRandomization()
virtual bool functionalRead(Packet *pkt)=0
The two functions below are used for reading / writing the message functionally.
Stats::Average m_buf_msgs
Tick m_time_last_time_size_checked
virtual void storeEventInfo(int info)
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Stats::Scalar m_stall_count
StallMsgMapType m_stall_msg_map
A map from line addresses to lists of stalled messages for that line.
void setMsgCounter(uint64_t c)
virtual bool functionalWrite(Packet *pkt)=0
#define panic(...)
This implements a cprintf based panic() function.
Tick curTick()
The current simulated tick.
Abstract superclass for simulation objects.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17