37 #include "debug/RubyQueue.hh"
41 using m5::stl_helpers::operator<<;
45 m_max_size(p->buffer_size), m_time_last_time_size_checked(0),
46 m_time_last_time_enqueue(0), m_time_last_time_pop(0),
47 m_last_arrival_time(0), m_strict_fifo(p->ordered),
48 m_randomization(p->randomization)
91 unsigned int current_size = 0;
111 DPRINTF(RubyQueue,
"n: %d, current_size: %d, heap size: %d, "
122 DPRINTF(RubyQueue,
"Peeking at head of queue.\n");
126 DPRINTF(RubyQueue,
"Message: %s\n", (*msg_ptr));
157 Tick arrival_time = 0;
161 arrival_time = current_time + delta;
175 assert(arrival_time > current_time);
178 panic(
"FIFO ordering violated: %s name: %s current time: %d "
179 "delta: %d arrival_time: %d last arrival_time: %d\n",
180 *
this,
name(), current_time, delta, arrival_time,
191 Message* msg_ptr = message.get();
192 assert(msg_ptr != NULL);
195 "ensure we aren't dequeued early");
207 DPRINTF(RubyQueue,
"Enqueue arrival_time: %lld, Message: %s\n",
208 arrival_time, *(message.get()));
219 DPRINTF(RubyQueue,
"Popping\n");
226 message->updateDelayedTicks(current_time);
227 Tick delay = message->getDelayedTicks();
240 if (decrement_messages) {
281 DPRINTF(RubyQueue,
"Recycling.\n");
286 Tick future_time = current_time + recycle_latency;
287 node->setLastEnqueueTime(future_time);
297 while (!lt.empty()) {
300 m->setLastEnqueueTime(schdTick);
315 DPRINTF(RubyQueue,
"ReanalyzeMessages %#x\n", addr);
325 assert(m_stall_map_size >= 0);
333 DPRINTF(RubyQueue,
"ReanalyzeAllMessages\n");
353 DPRINTF(RubyQueue,
"Stalling due to %#x\n", addr);
381 sort_heap(copy.begin(), copy.end(), greater<MsgPtr>());
389 (
m_prio_heap.front()->getLastEnqueueTime() <= current_time));
397 .
desc(
"Number of times this buffer did not have N slots available")
402 .
desc(
"Average number of messages in buffer")
407 .
desc(
"Number of times messages were stalled")
412 .
desc(
"Average occupancy of buffer capacity")
417 .
desc(
"Average number of cycles messages are stalled in this MB")
430 uint32_t num_functional_writes = 0;
437 num_functional_writes++;
448 it != (map_iter->second).end(); ++it) {
452 num_functional_writes++;
457 return num_functional_writes;
461 MessageBufferParams::create()
void ccprintf(cp::Print &print)
void print(std::ostream &out) const
Tick m_time_last_time_size_checked
Tick getLastEnqueueTime() const
std::shared_ptr< Message > MsgPtr
const bool m_randomization
MessageBuffer(const Params *p)
StallMsgMapType m_stall_msg_map
A map from line addresses to lists of stalled messages for that line.
void recycle(Tick current_time, Tick recycle_latency)
void reanalyzeMessages(Addr addr, Tick current_time)
void stallMessage(Addr addr, Tick current_time)
Stats::Average m_stall_time
virtual void storeEventInfo(int info)
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
unsigned int m_size_last_time_size_checked
uint32_t functionalWrite(Packet *pkt)
Stats::Average m_buf_msgs
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 scheduleEventAbsolute(Tick timeAbs)
unsigned int getSize(Tick curTime)
static bool getWarmupEnabled()
bool areNSlotsAvailable(unsigned int n, Tick curTime)
Tick curTick()
The current simulated tick.
void setMsgCounter(uint64_t c)
virtual bool functionalWrite(Packet *pkt)=0
uint64_t Tick
Tick count type.
Stats::Scalar m_not_avail_count
int m_stall_map_size
Current size of the stall map.
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...
void unregisterDequeueCallback()
Addr getOffset(Addr addr)
const Message * peek() const
Function for extracting the message at the head of the message queue.
unsigned int m_msgs_this_cycle
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void regStats()
Register statistics for this object.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
unsigned int m_size_at_cycle_start
Stats::Formula m_occupancy
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
bool isReady(Tick current_time) const
Consumer * m_consumer
Consumer to signal a wakeup(), can be NULL.
void reanalyzeList(std::list< MsgPtr > &, Tick)
virtual const std::string name() const
Tick m_time_last_time_pop
Stats::Scalar m_stall_count
Tick m_time_last_time_enqueue
void reanalyzeAllMessages(Tick current_time)
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
const unsigned int m_max_size
The maximum capacity.
void updateDelayedTicks(Tick curTime)
Update the delay this message has experienced so far.
std::function< void()> m_dequeue_callback
const FlagsType nozero
Don't print if this is zero.
std::vector< MsgPtr > m_prio_heap
void enqueue(MsgPtr message, Tick curTime, Tick delta)
void registerDequeueCallback(std::function< void()> callback)
MessageBufferParams Params
Abstract superclass for simulation objects.
void setLastEnqueueTime(const Tick &time)
static int getRandomization()