From 5e33045a2a5b55414d0b2a79ac2ef5ad8fa9eb9e Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Sun, 10 Feb 2013 21:26:26 -0600 Subject: ruby: replace Time with Cycles in MessageBuffer --- src/mem/ruby/buffers/MessageBuffer.cc | 22 ++++++++++------------ src/mem/ruby/buffers/MessageBuffer.hh | 12 ++++++------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc index f39e35738..c9b255c02 100644 --- a/src/mem/ruby/buffers/MessageBuffer.cc +++ b/src/mem/ruby/buffers/MessageBuffer.cc @@ -39,7 +39,8 @@ using namespace std; using m5::stl_helpers::operator<<; MessageBuffer::MessageBuffer(const string &name) - : m_last_arrival_time(0) + : m_time_last_time_size_checked(0), m_time_last_time_enqueue(0), + m_time_last_time_pop(0), m_last_arrival_time(0) { m_msg_counter = 0; m_consumer_ptr = NULL; @@ -51,9 +52,6 @@ MessageBuffer::MessageBuffer(const string &name) m_max_size = -1; m_randomization = true; m_size_last_time_size_checked = 0; - m_time_last_time_size_checked = 0; - m_time_last_time_enqueue = 0; - m_time_last_time_pop = 0; m_size_at_cycle_start = 0; m_msgs_this_cycle = 0; m_not_avail_count = 0; @@ -236,7 +234,7 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delta) } } -Time +Cycles MessageBuffer::dequeue_getDelayCycles(MsgPtr& message) { dequeue(message); @@ -253,14 +251,14 @@ MessageBuffer::dequeue(MsgPtr& message) DPRINTF(RubyQueue, "Enqueue message is %s\n", (*(message.get()))); } -Time +Cycles MessageBuffer::dequeue_getDelayCycles() { // get MsgPtr of the message about to be dequeued MsgPtr message = m_prio_heap.front().m_msgptr; // get the delay cycles - Time delayCycles = setAndReturnDelayCycles(message); + Cycles delayCycles = setAndReturnDelayCycles(message); dequeue(); return delayCycles; @@ -291,8 +289,8 @@ MessageBuffer::clear() m_msg_counter = 0; m_size = 0; - m_time_last_time_enqueue = 0; - m_time_last_time_pop = 0; + m_time_last_time_enqueue = Cycles(0); + m_time_last_time_pop = Cycles(0); m_size_at_cycle_start = 0; m_msgs_this_cycle = 0; } @@ -319,7 +317,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr) { DPRINTF(RubyQueue, "ReanalyzeMessages\n"); assert(m_stall_msg_map.count(addr) > 0); - Cycles nextCycle(m_clockobj_ptr->curCycle() + Cycles(1)); + Cycles nextCycle = m_clockobj_ptr->curCycle() + Cycles(1); // // Put all stalled messages associated with this address back on the @@ -344,7 +342,7 @@ void MessageBuffer::reanalyzeAllMessages() { DPRINTF(RubyQueue, "ReanalyzeAllMessages %s\n"); - Cycles nextCycle(m_clockobj_ptr->curCycle() + Cycles(1)); + Cycles nextCycle = m_clockobj_ptr->curCycle() + Cycles(1); // // Put all stalled messages associated with this address back on the @@ -388,7 +386,7 @@ MessageBuffer::stallMessage(const Address& addr) (m_stall_msg_map[addr]).push_back(message); } -Time +Cycles MessageBuffer::setAndReturnDelayCycles(MsgPtr msg_ptr) { // get the delay cycles of the message at the top of the queue diff --git a/src/mem/ruby/buffers/MessageBuffer.hh b/src/mem/ruby/buffers/MessageBuffer.hh index 5bad45f2d..e68a05786 100644 --- a/src/mem/ruby/buffers/MessageBuffer.hh +++ b/src/mem/ruby/buffers/MessageBuffer.hh @@ -115,11 +115,11 @@ class MessageBuffer void enqueue(MsgPtr message, Cycles delta); //! returns delay ticks of the message. - Time dequeue_getDelayCycles(MsgPtr& message); + Cycles dequeue_getDelayCycles(MsgPtr& message); void dequeue(MsgPtr& message); //! returns delay cycles of the message - Time dequeue_getDelayCycles(); + Cycles dequeue_getDelayCycles(); void dequeue() { pop(); } void pop(); void recycle(); @@ -160,7 +160,7 @@ class MessageBuffer Cycles m_recycle_latency; // Private Methods - Time setAndReturnDelayCycles(MsgPtr message); + Cycles setAndReturnDelayCycles(MsgPtr message); // Private copy constructor and assignment operator MessageBuffer(const MessageBuffer& obj); @@ -184,13 +184,13 @@ class MessageBuffer int m_max_size; int m_size; - Time m_time_last_time_size_checked; + Cycles m_time_last_time_size_checked; int m_size_last_time_size_checked; // variables used so enqueues appear to happen imediately, while // pop happen the next cycle - Time m_time_last_time_enqueue; - Time m_time_last_time_pop; + Cycles m_time_last_time_enqueue; + Cycles m_time_last_time_pop; int m_size_at_cycle_start; int m_msgs_this_cycle; -- cgit v1.2.3