changeset 669c1d2df752 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=669c1d2df752
description:
        Stats:  fix dist stat and enable VectorDistStat

diffstat:

 src/base/statistics.hh |  23 ++++++++++++++---------
 src/base/stats/text.cc |   2 +-
 2 files changed, 15 insertions(+), 10 deletions(-)

diffs (85 lines):

diff -r cbedf338fc44 -r 669c1d2df752 src/base/statistics.hh
--- a/src/base/statistics.hh    Thu Jun 03 10:34:40 2010 -0700
+++ b/src/base/statistics.hh    Thu Jun 03 11:06:12 2010 -0700
@@ -1698,7 +1698,11 @@
         delete [] reinterpret_cast<char *>(storage);
     }
 
-    Proxy operator[](off_type index);
+    Proxy operator[](off_type index)
+    {
+        assert(index >= 0 && index < size());
+        return Proxy(this->self(), index);
+    }
 
     size_type
     size() const
@@ -1739,15 +1743,15 @@
 class DistProxy
 {
   private:
-    Stat *stat;
+    Stat &stat;
     off_type index;
 
   protected:
-    typename Stat::Storage *data() { return stat->data(index); }
-    const typename Stat::Storage *data() const { return stat->data(index); }
+    typename Stat::Storage *data() { return stat.data(index); }
+    const typename Stat::Storage *data() const { return stat.data(index); }
 
   public:
-    DistProxy(Stat *s, off_type i)
+    DistProxy(Stat &s, off_type i)
         : stat(s), index(i)
     {}
 
@@ -1788,15 +1792,16 @@
      */
     void reset() { }
 };
-
+/*
 template <class Derived, class Stor>
 inline typename VectorDistBase<Derived, Stor>::Proxy
 VectorDistBase<Derived, Stor>::operator[](off_type index)
 {
     assert (index >= 0 && index < size());
     typedef typename VectorDistBase<Derived, Stor>::Proxy Proxy;
-    return Proxy(this, index);
+    return Proxy(this->self(), index);
 }
+*/
 
 #if 0
 template <class Storage>
@@ -2267,7 +2272,7 @@
         params->min = min;
         params->max = max;
         params->bucket_size = bkt;
-        params->buckets = (size_type)rint((max - min) / bkt + 1.0);
+        params->buckets = (size_type)rint((max - min + 1.0) / bkt );
         this->setParams(params);
         this->doInit();
         return this->self();
@@ -2328,7 +2333,7 @@
         params->min = min;
         params->max = max;
         params->bucket_size = bkt;
-        params->buckets = (size_type)rint((max - min) / bkt + 1.0);
+        params->buckets = (size_type)rint((max - min + 1.0) / bkt);
         this->setParams(params);
         this->doInit(size);
         return this->self();
diff -r cbedf338fc44 -r 669c1d2df752 src/base/stats/text.cc
--- a/src/base/stats/text.cc    Thu Jun 03 10:34:40 2010 -0700
+++ b/src/base/stats/text.cc    Thu Jun 03 11:06:12 2010 -0700
@@ -412,7 +412,7 @@
         namestr << base;
 
         Counter low = i * bucket_size + min;
-        Counter high = ::min(low + bucket_size, max);
+        Counter high = ::min(low + bucket_size - 1.0, max);
         namestr << low;
         if (low < high)
             namestr << "-" << high;
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to