changeset ad631c296c9b in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=ad631c296c9b
description:
stats: cleanup a few small problems in stats
diffstat:
src/base/statistics.hh | 43 ++++++++++++++++---------------------------
src/base/stats/text.cc | 16 ++++++++++++----
src/unittest/stattest.cc | 14 +++++++-------
3 files changed, 35 insertions(+), 38 deletions(-)
diffs (207 lines):
diff -r 37da2c208f5f -r ad631c296c9b src/base/statistics.hh
--- a/src/base/statistics.hh Wed Jul 21 15:53:53 2010 -0700
+++ b/src/base/statistics.hh Wed Jul 21 15:53:53 2010 -0700
@@ -401,7 +401,7 @@
}
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 @@
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 @@
return self;
}
- std::string ysubname(off_type i) const { return (*this->y_subnames)[i]; }
-
Proxy
operator[](off_type index)
{
@@ -1713,13 +1718,10 @@
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 @@
*/
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 @@
*/
StandardDeviation()
{
+ SampleStor::Params *params = new SampleStor::Params;
this->doInit();
+ this->setParams(params);
}
};
@@ -2307,7 +2290,9 @@
*/
AverageDeviation()
{
+ AvgSampleStor::Params *params = new AvgSampleStor::Params;
this->doInit();
+ this->setParams(params);
}
};
@@ -2356,7 +2341,9 @@
VectorStandardDeviation &
init(size_type size)
{
+ SampleStor::Params *params = new SampleStor::Params;
this->doInit(size);
+ this->setParams(params);
return this->self();
}
};
@@ -2377,7 +2364,9 @@
VectorAverageDeviation &
init(size_type size)
{
+ AvgSampleStor::Params *params = new AvgSampleStor::Params;
this->doInit(size);
+ this->setParams(params);
return this->self();
}
};
diff -r 37da2c208f5f -r ad631c296c9b src/base/stats/text.cc
--- a/src/base/stats/text.cc Wed Jul 21 15:53:53 2010 -0700
+++ b/src/base/stats/text.cc Wed Jul 21 15:53:53 2010 -0700
@@ -348,10 +348,18 @@
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
diff -r 37da2c208f5f -r ad631c296c9b src/unittest/stattest.cc
--- a/src/unittest/stattest.cc Wed Jul 21 15:53:53 2010 -0700
+++ b/src/unittest/stattest.cc Wed Jul 21 15:53:53 2010 -0700
@@ -38,6 +38,7 @@
#include "base/stats/text.hh"
#include "base/stats/mysql.hh"
#include "base/types.hh"
+#include "sim/stat_control.hh"
using namespace std;
using namespace Stats;
@@ -67,7 +68,6 @@
main(int argc, char *argv[])
{
bool descriptions = false;
- bool compat = false;
bool text = false;
#if USE_MYSQL
@@ -82,9 +82,6 @@
progname = argv[0];
while ((c = getopt(argc, argv, "cD:dh:P:p:s:tu:")) != -1) {
switch (c) {
- case 'c':
- compat = true;
- break;
case 'd':
descriptions = true;
break;
@@ -113,9 +110,11 @@
}
}
- if (!text && (compat || descriptions))
+ if (!text && descriptions)
usage();
+ initSimStats();
+
Scalar s1;
Scalar s2;
Average s3;
@@ -304,7 +303,7 @@
f4 += s5[3];
f5 = constant(1);
- check();
+ enable();
reset();
s16[1][0] = 1;
@@ -545,10 +544,11 @@
s12.sample(100);
+ prepare();
+
if (text) {
Text out(cout);
out.descriptions = descriptions;
- out.compat = compat;
out();
}
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev