changeset 039202aafc0d in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=039202aafc0d
description:
        stats: this makes some fixes to AverageStat and AverageVector.
        Also, make Formulas work on AverageVector.  First, Stat::Average (and 
thus
        Stats::AverageVector) was broken when coming out of a checkpoint and on 
resets,
        this fixes that.  Formulas also didn't work with AverageVector, but 
added
        support for that.

diffstat:

2 files changed, 10 insertions(+), 2 deletions(-)
src/base/statistics.hh    |   11 +++++++++--
src/python/m5/simulate.py |    1 +

diffs (60 lines):

diff -r 1d7008e14da6 -r 039202aafc0d src/base/statistics.hh
--- a/src/base/statistics.hh    Tue Feb 23 09:33:09 2010 -0800
+++ b/src/base/statistics.hh    Tue Feb 23 09:33:18 2010 -0800
@@ -492,6 +492,8 @@
   private:
     /** The current count. */
     Counter current;
+    /** The tick of the last reset */
+    Tick lastReset;
     /** The total count for all tick. */
     mutable Result total;
     /** The tick that current last changed. */
@@ -505,7 +507,7 @@
      * Build and initializes this stat storage.
      */
     AvgStor(Info *info)
-        : current(0), total(0), last(0)
+        : current(0), lastReset(0), total(0), last(0)
     { }
 
     /**
@@ -547,7 +549,7 @@
     result() const
     {
         assert(last == curTick);
-        return (Result)(total + current) / (Result)(curTick + 1);
+        return (Result)(total + current) / (Result)(curTick - lastReset + 1);
     }
 
     /**
@@ -573,6 +575,7 @@
     {
         total = 0.0;
         last = curTick;
+        lastReset = curTick;
     }
 
 };
@@ -2551,6 +2554,10 @@
         : node(new VectorStatNode(s.info()))
     { }
 
+    Temp(const AverageVector &s)
+        : node(new VectorStatNode(s.info()))
+    { }
+
     /**
      *
      */
diff -r 1d7008e14da6 -r 039202aafc0d src/python/m5/simulate.py
--- a/src/python/m5/simulate.py Tue Feb 23 09:33:09 2010 -0800
+++ b/src/python/m5/simulate.py Tue Feb 23 09:33:18 2010 -0800
@@ -148,6 +148,7 @@
     print "Restoring from checkpoint"
     internal.core.unserializeAll(dir)
     need_resume.append(root)
+    stats.reset()
 
 def changeToAtomic(system):
     if not isinstance(system, (objects.Root, objects.System)):
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to