changeset e958cdc5c669 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=e958cdc5c669
description:
        ruby: consumer: avoid accessing wakeup times when waking up
        Each consumer object maintains a set of tick values when the object is 
supposed
        to wakeup and do some processing.  As of now, the object accesses this 
set both
        when scheduling a wakeup event and when the object actually wakes up.  
The set
        is accessed during wakeup to remove the current tick value from the 
set.  This
        functionality is now being moved to the scheduling function where ticks 
are
        removed at a later time.

diffstat:

 src/mem/ruby/common/Consumer.cc |   7 +++++++
 src/mem/ruby/common/Consumer.hh |  28 ++--------------------------
 2 files changed, 9 insertions(+), 26 deletions(-)

diffs (87 lines):

diff -r 1268f1fd2714 -r e958cdc5c669 src/mem/ruby/common/Consumer.cc
--- a/src/mem/ruby/common/Consumer.cc   Thu Mar 20 09:14:14 2014 -0500
+++ b/src/mem/ruby/common/Consumer.cc   Thu Mar 20 09:14:14 2014 -0500
@@ -28,6 +28,8 @@
 
 #include "mem/ruby/common/Consumer.hh"
 
+using namespace std;
+
 void
 Consumer::scheduleEvent(Cycles timeDelta)
 {
@@ -43,4 +45,9 @@
         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 -r 1268f1fd2714 -r e958cdc5c669 src/mem/ruby/common/Consumer.hh
--- a/src/mem/ruby/common/Consumer.hh   Thu Mar 20 09:14:14 2014 -0500
+++ b/src/mem/ruby/common/Consumer.hh   Thu Mar 20 09:14:14 2014 -0500
@@ -44,7 +44,7 @@
 {
   public:
     Consumer(ClockedObject *_em)
-        : m_last_scheduled_wakeup(0), em(_em)
+        : em(_em)
     {
     }
 
@@ -56,18 +56,6 @@
     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 @@
         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 @@
           {
           }
 
-          void process()
-          {
-              m_consumer_ptr->wakeup();
-              m_consumer_ptr->removeScheduledWakeupTime(when());
-          }
+          void process() { m_consumer_ptr->wakeup(); }
 
       private:
           Consumer* m_consumer_ptr;
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to