changeset f4ba9a861e65 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=f4ba9a861e65
description:
        ruby: reset timing after cache warm up
        Ruby system was recently converted to a clocked object. Such objects 
maintain
        state related to the time that has passed so far. During the cache 
warmup, Ruby
        system changes its own time and the global time. Later on, the global 
time is
        restored. So Ruby system also needs to reset its own time.

diffstat:

 src/mem/ruby/system/System.cc |   6 ++++--
 src/sim/clocked_object.hh     |  12 ++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r 0b9fcd304b58 -r f4ba9a861e65 src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc     Mon Oct 15 12:51:21 2012 -0400
+++ b/src/mem/ruby/system/System.cc     Mon Oct 15 17:27:15 2012 -0500
@@ -354,8 +354,9 @@
         Tick curtick_original = curTick();
         // save the event queue head
         Event* eventq_head = eventq->replaceHead(NULL);
-        // set curTick to 0
+        // set curTick to 0 and reset Ruby System's clock
         curTick(0);
+        resetClock();
 
         // Schedule an event to start cache warmup
         enqueueRubyEvent(curTick());
@@ -369,8 +370,9 @@
         m_memory_controller->reset();
         // Restore eventq head
         eventq_head = eventq->replaceHead(eventq_head);
-        // Restore curTick
+        // Restore curTick and Ruby System's clock
         curTick(curtick_original);
+        resetClock();
     }
 }
 
diff -r 0b9fcd304b58 -r f4ba9a861e65 src/sim/clocked_object.hh
--- a/src/sim/clocked_object.hh Mon Oct 15 12:51:21 2012 -0400
+++ b/src/sim/clocked_object.hh Mon Oct 15 17:27:15 2012 -0500
@@ -119,6 +119,18 @@
      */
     virtual ~ClockedObject() { }
 
+    /**
+     * Reset the object's clock using the current global tick value. Likely
+     * to be used only when the global clock is reset. Currently, this done
+     * only when Ruby is done warming up the memory system.
+     */
+    void resetClock() const
+    {
+        Cycles elapsedCycles(divCeil(curTick(), clock));
+        cycle = elapsedCycles;
+        tick = elapsedCycles * clock;
+    }
+
   public:
 
     /**
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to