summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-07-21 15:53:53 -0700
committerNathan Binkert <nate@binkert.org>2010-07-21 15:53:53 -0700
commit2a1309f2134986edcbff846aff5951ec1e8df6e1 (patch)
treec5168a212471551d5b08817bbafc2a24d8fa1666 /src/base
parent76c92c3e308c13b031dfa739d51f9f1f6917bd4b (diff)
downloadgem5-2a1309f2134986edcbff846aff5951ec1e8df6e1.tar.xz
stats: cleanup a few small problems in stats
Diffstat (limited to 'src/base')
-rw-r--r--src/base/statistics.hh43
-rw-r--r--src/base/stats/text.cc16
2 files changed, 28 insertions, 31 deletions
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 37bb1b90b..5fca376e3 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -401,7 +401,7 @@ class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType>
}
Derived &
- ysubname(off_type index, const std::string subname)
+ ysubname(off_type index, const std::string &subname)
{
Derived &self = this->self();
Info *info = this->info();
@@ -411,6 +411,13 @@ class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType>
info->y_subnames[index] = subname.c_str();
return self;
}
+
+ std::string
+ ysubname(off_type i) const
+ {
+ return this->info()->y_subnames[i];
+ }
+
};
//////////////////////////////////////////////////////////////////////
@@ -1197,8 +1204,6 @@ class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
return self;
}
- std::string ysubname(off_type i) const { return (*this->y_subnames)[i]; }
-
Proxy
operator[](off_type index)
{
@@ -1713,13 +1718,10 @@ class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy>
bool
zero() const
{
- return false;
-#if 0
for (off_type i = 0; i < size(); ++i)
if (!data(i)->zero())
return false;
return true;
-#endif
}
void
@@ -1792,27 +1794,6 @@ class DistProxy
*/
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->self(), index);
-}
-*/
-
-#if 0
-template <class Storage>
-Result
-VectorDistBase<Storage>::total(off_type index) const
-{
- Result total = 0.0;
- for (off_type i = 0; i < x_size(); ++i)
- total += data(i)->result();
-}
-#endif
//////////////////////////////////////////////////////////////////////
//
@@ -2291,7 +2272,9 @@ class StandardDeviation : public DistBase<StandardDeviation, SampleStor>
*/
StandardDeviation()
{
+ SampleStor::Params *params = new SampleStor::Params;
this->doInit();
+ this->setParams(params);
}
};
@@ -2307,7 +2290,9 @@ class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor>
*/
AverageDeviation()
{
+ AvgSampleStor::Params *params = new AvgSampleStor::Params;
this->doInit();
+ this->setParams(params);
}
};
@@ -2356,7 +2341,9 @@ class VectorStandardDeviation
VectorStandardDeviation &
init(size_type size)
{
+ SampleStor::Params *params = new SampleStor::Params;
this->doInit(size);
+ this->setParams(params);
return this->self();
}
};
@@ -2377,7 +2364,9 @@ class VectorAverageDeviation
VectorAverageDeviation &
init(size_type size)
{
+ AvgSampleStor::Params *params = new AvgSampleStor::Params;
this->doInit(size);
+ this->setParams(params);
return this->self();
}
};
diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc
index f3c4d1c58..87bb05323 100644
--- a/src/base/stats/text.cc
+++ b/src/base/stats/text.cc
@@ -348,10 +348,18 @@ DistPrint::init(const Text *text, const Info &info, const DistParams *params)
descriptions = text->descriptions;
type = params->type;
- min = params->min;
- max = params->max;
- bucket_size = params->bucket_size;
- size = params->buckets;
+ switch (type) {
+ case Dist:
+ min = params->min;
+ max = params->max;
+ bucket_size = params->bucket_size;
+ size = params->buckets;
+ break;
+ case Deviation:
+ break;
+ default:
+ panic("unknown distribution type");
+ }
}
void