diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2012-08-27 01:00:55 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2012-08-27 01:00:55 -0500 |
commit | 9190940511b5783811bc6288dd4f22f8d18c9d26 (patch) | |
tree | 72a07f80a772d7c6f2a6f0255cee173ac631cb35 /src/mem/ruby/buffers | |
parent | 7122b83d8f92d77bccae432b4e90ba12f1babad5 (diff) | |
download | gem5-9190940511b5783811bc6288dd4f22f8d18c9d26.tar.xz |
Ruby: Remove RubyEventQueue
This patch removes RubyEventQueue. Consumer objects now rely on RubySystem
or themselves for scheduling events.
Diffstat (limited to 'src/mem/ruby/buffers')
-rw-r--r-- | src/mem/ruby/buffers/MessageBuffer.cc | 53 | ||||
-rw-r--r-- | src/mem/ruby/buffers/MessageBuffer.hh | 3 |
2 files changed, 27 insertions, 29 deletions
diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc index 9a7fdb61b..ee1c709f1 100644 --- a/src/mem/ruby/buffers/MessageBuffer.cc +++ b/src/mem/ruby/buffers/MessageBuffer.cc @@ -66,10 +66,10 @@ MessageBuffer::MessageBuffer(const string &name) int MessageBuffer::getSize() { - if (m_time_last_time_size_checked == g_eventQueue_ptr->getTime()) { + if (m_time_last_time_size_checked == g_system_ptr->getTime()) { return m_size_last_time_size_checked; } else { - m_time_last_time_size_checked = g_eventQueue_ptr->getTime(); + m_time_last_time_size_checked = g_system_ptr->getTime(); m_size_last_time_size_checked = m_size; return m_size; } @@ -89,11 +89,11 @@ MessageBuffer::areNSlotsAvailable(int n) // until next cycle, but enqueue operations effect the visible // size immediately int current_size = max(m_size_at_cycle_start, m_size); - if (m_time_last_time_pop < g_eventQueue_ptr->getTime()) { + if (m_time_last_time_pop < g_system_ptr->getTime()) { // no pops this cycle - m_size is correct current_size = m_size; } else { - if (m_time_last_time_enqueue < g_eventQueue_ptr->getTime()) { + if (m_time_last_time_enqueue < g_system_ptr->getTime()) { // no enqueues this cycle - m_size_at_cycle_start is correct current_size = m_size_at_cycle_start; } else { @@ -155,9 +155,9 @@ MessageBuffer::enqueue(MsgPtr message, Time delta) m_size++; // record current time incase we have a pop that also adjusts my size - if (m_time_last_time_enqueue < g_eventQueue_ptr->getTime()) { + if (m_time_last_time_enqueue < g_system_ptr->getTime()) { m_msgs_this_cycle = 0; // first msg this cycle - m_time_last_time_enqueue = g_eventQueue_ptr->getTime(); + m_time_last_time_enqueue = g_system_ptr->getTime(); } m_msgs_this_cycle++; @@ -168,7 +168,7 @@ MessageBuffer::enqueue(MsgPtr message, Time delta) // Calculate the arrival time of the message, that is, the first // cycle the message can be dequeued. assert(delta>0); - Time current_time = g_eventQueue_ptr->getTime(); + Time current_time = g_system_ptr->getTime(); Time arrival_time = 0; if (!RubySystem::getRandomization() || (m_randomization == false)) { // No randomization @@ -192,10 +192,10 @@ MessageBuffer::enqueue(MsgPtr message, Time delta) panic("FIFO ordering violated: %s name: %s current time: %d " "delta: %d arrival_time: %d last arrival_time: %d\n", *this, m_name, - current_time * g_eventQueue_ptr->getClock(), - delta * g_eventQueue_ptr->getClock(), - arrival_time * g_eventQueue_ptr->getClock(), - m_last_arrival_time * g_eventQueue_ptr->getClock()); + current_time * g_system_ptr->getClock(), + delta * g_system_ptr->getClock(), + arrival_time * g_system_ptr->getClock(), + m_last_arrival_time * g_system_ptr->getClock()); } } @@ -208,10 +208,10 @@ MessageBuffer::enqueue(MsgPtr message, Time delta) Message* msg_ptr = message.get(); assert(msg_ptr != NULL); - assert(g_eventQueue_ptr->getTime() >= msg_ptr->getLastEnqueueTime() && + assert(g_system_ptr->getTime() >= msg_ptr->getLastEnqueueTime() && "ensure we aren't dequeued early"); - msg_ptr->setDelayedCycles(g_eventQueue_ptr->getTime() - + msg_ptr->setDelayedCycles(g_system_ptr->getTime() - msg_ptr->getLastEnqueueTime() + msg_ptr->getDelayedCycles()); msg_ptr->setLastEnqueueTime(arrival_time); @@ -223,12 +223,12 @@ MessageBuffer::enqueue(MsgPtr message, Time delta) greater<MessageBufferNode>()); DPRINTF(RubyQueue, "Enqueue with arrival_time %lld.\n", - arrival_time * g_eventQueue_ptr->getClock()); + arrival_time * g_system_ptr->getClock()); DPRINTF(RubyQueue, "Enqueue Message: %s.\n", (*(message.get()))); // Schedule the wakeup if (m_consumer_ptr != NULL) { - g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, arrival_time); + m_consumer_ptr->scheduleEventAbsolute(arrival_time); m_consumer_ptr->storeEventInfo(m_vnet_id); } else { panic("No consumer: %s name: %s\n", *this, m_name); @@ -287,9 +287,9 @@ MessageBuffer::pop() // record previous size and time so the current buffer size isn't // adjusted until next cycle - if (m_time_last_time_pop < g_eventQueue_ptr->getTime()) { + if (m_time_last_time_pop < g_system_ptr->getTime()) { m_size_at_cycle_start = m_size; - m_time_last_time_pop = g_eventQueue_ptr->getTime(); + m_time_last_time_pop = g_system_ptr->getTime(); } m_size--; } @@ -315,12 +315,12 @@ MessageBuffer::recycle() MessageBufferNode node = m_prio_heap.front(); pop_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MessageBufferNode>()); - node.m_time = g_eventQueue_ptr->getTime() + m_recycle_latency; + node.m_time = g_system_ptr->getTime() + m_recycle_latency; m_prio_heap.back() = node; push_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MessageBufferNode>()); - g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, - g_eventQueue_ptr->getTime() + m_recycle_latency); + m_consumer_ptr->scheduleEventAbsolute(g_system_ptr->getTime() + + m_recycle_latency); } void @@ -335,7 +335,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr) // while(!m_stall_msg_map[addr].empty()) { m_msg_counter++; - MessageBufferNode msgNode(g_eventQueue_ptr->getTime() + 1, + MessageBufferNode msgNode(g_system_ptr->getTime() + 1, m_msg_counter, m_stall_msg_map[addr].front()); @@ -343,7 +343,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr) push_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MessageBufferNode>()); - g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, msgNode.m_time); + m_consumer_ptr->scheduleEventAbsolute(msgNode.m_time); m_stall_msg_map[addr].pop_front(); } m_stall_msg_map.erase(addr); @@ -364,7 +364,7 @@ MessageBuffer::reanalyzeAllMessages() while(!(map_iter->second).empty()) { m_msg_counter++; - MessageBufferNode msgNode(g_eventQueue_ptr->getTime() + 1, + MessageBufferNode msgNode(g_system_ptr->getTime() + 1, m_msg_counter, (map_iter->second).front()); @@ -372,8 +372,7 @@ MessageBuffer::reanalyzeAllMessages() push_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MessageBufferNode>()); - g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, - msgNode.m_time); + m_consumer_ptr->scheduleEventAbsolute(msgNode.m_time); (map_iter->second).pop_front(); } } @@ -407,8 +406,8 @@ MessageBuffer::setAndReturnDelayCycles(MsgPtr msg_ptr) // this function should only be called on dequeue // ensure the msg hasn't been enqueued - assert(msg_ptr->getLastEnqueueTime() <= g_eventQueue_ptr->getTime()); - msg_ptr->setDelayedCycles(g_eventQueue_ptr->getTime() - + assert(msg_ptr->getLastEnqueueTime() <= g_system_ptr->getTime()); + msg_ptr->setDelayedCycles(g_system_ptr->getTime() - msg_ptr->getLastEnqueueTime() + msg_ptr->getDelayedCycles()); delay_cycles = msg_ptr->getDelayedCycles(); diff --git a/src/mem/ruby/buffers/MessageBuffer.hh b/src/mem/ruby/buffers/MessageBuffer.hh index 4193c9f73..cf7e77c2d 100644 --- a/src/mem/ruby/buffers/MessageBuffer.hh +++ b/src/mem/ruby/buffers/MessageBuffer.hh @@ -45,7 +45,6 @@ #include "mem/ruby/common/Address.hh" #include "mem/ruby/common/Consumer.hh" #include "mem/ruby/common/Global.hh" -#include "mem/ruby/eventqueue/RubyEventQueue.hh" #include "mem/ruby/slicc_interface/Message.hh" class MessageBuffer @@ -70,7 +69,7 @@ class MessageBuffer isReady() const { return ((m_prio_heap.size() > 0) && - (m_prio_heap.front().m_time <= g_eventQueue_ptr->getTime())); + (m_prio_heap.front().m_time <= g_system_ptr->getTime())); } void |