#include "mem/ruby/common/Consumer.hh"
+using namespace std;
+
void
Consumer::scheduleEvent(Cycles timeDelta)
{
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);
}
{
public:
Consumer(ClockedObject *_em)
- : m_last_scheduled_wakeup(0), em(_em)
+ : em(_em)
{
}
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)
{
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;
{
}
- void process()
- {
- m_consumer_ptr->wakeup();
- m_consumer_ptr->removeScheduledWakeupTime(when());
- }
+ void process() { m_consumer_ptr->wakeup(); }
private:
Consumer* m_consumer_ptr;