summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mem/ruby/common/Consumer.cc7
-rw-r--r--src/mem/ruby/common/Consumer.hh28
2 files changed, 9 insertions, 26 deletions
diff --git a/src/mem/ruby/common/Consumer.cc b/src/mem/ruby/common/Consumer.cc
index 9f3735709..59605d51b 100644
--- a/src/mem/ruby/common/Consumer.cc
+++ b/src/mem/ruby/common/Consumer.cc
@@ -28,6 +28,8 @@
#include "mem/ruby/common/Consumer.hh"
+using namespace std;
+
void
Consumer::scheduleEvent(Cycles timeDelta)
{
@@ -43,4 +45,9 @@ Consumer::scheduleEventAbsolute(Tick evt_time)
em->schedule(evt, evt_time);
insertScheduledWakeupTime(evt_time);
}
+
+ Tick t = em->clockEdge();
+ set<Tick>::iterator bit = m_scheduled_wakeups.begin();
+ set<Tick>::iterator eit = m_scheduled_wakeups.lower_bound(t);
+ m_scheduled_wakeups.erase(bit,eit);
}
diff --git a/src/mem/ruby/common/Consumer.hh b/src/mem/ruby/common/Consumer.hh
index 57ee69f3e..20f2bdd0f 100644
--- a/src/mem/ruby/common/Consumer.hh
+++ b/src/mem/ruby/common/Consumer.hh
@@ -44,7 +44,7 @@ class Consumer
{
public:
Consumer(ClockedObject *_em)
- : m_last_scheduled_wakeup(0), em(_em)
+ : em(_em)
{
}
@@ -56,18 +56,6 @@ class Consumer
virtual void print(std::ostream& out) const = 0;
virtual void storeEventInfo(int info) {}
- const Tick&
- getLastScheduledWakeup() const
- {
- return m_last_scheduled_wakeup;
- }
-
- void
- setLastScheduledWakeup(const Tick& time)
- {
- m_last_scheduled_wakeup = time;
- }
-
bool
alreadyScheduled(Tick time)
{
@@ -80,20 +68,12 @@ class Consumer
m_scheduled_wakeups.insert(time);
}
- void
- removeScheduledWakeupTime(Tick time)
- {
- assert(alreadyScheduled(time));
- m_scheduled_wakeups.erase(time);
- }
-
void scheduleEventAbsolute(Tick timeAbs);
protected:
void scheduleEvent(Cycles timeDelta);
private:
- Tick m_last_scheduled_wakeup;
std::set<Tick> m_scheduled_wakeups;
ClockedObject *em;
@@ -105,11 +85,7 @@ class Consumer
{
}
- void process()
- {
- m_consumer_ptr->wakeup();
- m_consumer_ptr->removeScheduledWakeupTime(when());
- }
+ void process() { m_consumer_ptr->wakeup(); }
private:
Consumer* m_consumer_ptr;