summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-02-10 21:26:26 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2013-02-10 21:26:26 -0600
commit5e33045a2a5b55414d0b2a79ac2ef5ad8fa9eb9e (patch)
tree30cb5163ff42de320a2d2725714d90c541ecdb08
parentb742081cc13f31bb5ebb10739a2e37727d80a085 (diff)
downloadgem5-5e33045a2a5b55414d0b2a79ac2ef5ad8fa9eb9e.tar.xz
ruby: replace Time with Cycles in MessageBuffer
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.cc22
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.hh12
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;