Merge with head.
[gem5.git] / src / base / statistics.hh
index 2b1b327e5b1bd70c8a182cc5956dca58ef53dcfe..8d3f53d4cb492e12fe519ec9b2ae6388da2cfe8d 100644 (file)
@@ -70,7 +70,7 @@
 
 class Callback;
 
-/** The current simulated cycle. */
+/** The current simulated tick. */
 extern Tick curTick;
 
 /* A namespace for all of the Statistics */
@@ -598,9 +598,9 @@ struct StatStor
 };
 
 /**
- * Templatized storage and interface to a per-cycle average stat. This keeps
- * a current count and updates a total (count * cycles) when this count
- * changes. This allows the quick calculation of a per cycle count of the item
+ * Templatized storage and interface to a per-tick average stat. This keeps
+ * a current count and updates a total (count * ticks) when this count
+ * changes. This allows the quick calculation of a per tick count of the item
  * being watched. This is good for keeping track of residencies in structures
  * among other things.
  */
@@ -613,9 +613,9 @@ struct AvgStor
   private:
     /** The current count. */
     Counter current;
-    /** The total count for all cycles. */
+    /** The total count for all tick. */
     mutable Result total;
-    /** The cycle that current last changed. */
+    /** The tick that current last changed. */
     mutable Tick last;
 
   public:
@@ -1563,7 +1563,7 @@ struct FancyStor
 };
 
 /**
- * Templatized storage for distribution that calculates per cycle mean and
+ * Templatized storage for distribution that calculates per tick mean and
  * variance.
  */
 struct AvgFancy
@@ -2094,9 +2094,13 @@ class UnaryNode : public Node
         return vresult;
     }
 
-    Result total() const {
-        Op op;
-        return op(l->total());
+    Result total() const
+    {
+        const VResult &vec = this->result();
+        Result total = 0;
+        for (int i = 0; i < size(); i++)
+            total += vec[i];
+        return total;
     }
 
     virtual size_t size() const { return l->size(); }
@@ -2149,9 +2153,13 @@ class BinaryNode : public Node
         return vresult;
     }
 
-    Result total() const {
-        Op op;
-        return op(l->total(), r->total());
+    Result total() const
+    {
+        const VResult &vec = this->result();
+        Result total = 0;
+        for (int i = 0; i < size(); i++)
+            total += vec[i];
+        return total;
     }
 
     virtual size_t size() const {
@@ -2280,7 +2288,7 @@ class Value : public Wrap<Value, ValueBase, ScalarStatData>
 };
 
 /**
- * A stat that calculates the per cycle average of a value.
+ * A stat that calculates the per tick average of a value.
  * @sa Stat, ScalarBase, AvgStor
  */
 template<int N = 0>
@@ -2417,7 +2425,7 @@ class StandardDeviation
 };
 
 /**
- * Calculates the per cycle mean and variance of the samples.
+ * Calculates the per tick mean and variance of the samples.
  * @sa Stat, DistBase, AvgFancy
  */
 template<int N = 0>
@@ -2839,6 +2847,7 @@ class Temp
  */
 
 void check();
+void dump();
 void reset();
 void registerResetCallback(Callback *cb);