From 244c2a517a48a0985091397bed6a754cb2e2e1a5 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 5 Mar 2009 19:09:53 -0800 Subject: [PATCH] stats: stick the distribution's fancy parameter into the parameters structure. --- src/base/statistics.hh | 23 ++++++++++------------- src/base/stats/mysql.cc | 8 ++++---- src/base/stats/text.cc | 17 ++++++++--------- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 9e641548c..6f2da2f3e 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -257,8 +257,6 @@ struct DistData Counter sum; Counter squares; Counter samples; - - bool fancy; }; class DistInfoBase : public Info @@ -1419,8 +1417,9 @@ class DistStor Counter bucket_size; /** The number of buckets. Equal to (max-min)/bucket_size. */ size_type buckets; + + enum { fancy = false }; }; - enum { fancy = false }; private: /** The minimum value to track. */ @@ -1556,10 +1555,10 @@ class DistStor class FancyStor { public: - struct Params : public StorageParams {}; - - public: - enum { fancy = true }; + struct Params : public StorageParams + { + enum { fancy = true }; + }; private: /** The current sum. */ @@ -1632,10 +1631,10 @@ class FancyStor class AvgFancy { public: - struct Params : public StorageParams {}; - - public: - enum { fancy = true }; + struct Params : public StorageParams + { + enum { fancy = true }; + }; private: /** Current total. */ @@ -1765,7 +1764,6 @@ class DistBase : public InfoAccess void update(DistInfoBase *base) { - base->data.fancy = Storage::fancy; data()->update(info(), base->data); } @@ -1881,7 +1879,6 @@ class VectorDistBase : public InfoAccess size_type size = this->size(); base->data.resize(size); for (off_type i = 0; i < size; ++i) { - base->data[i].fancy = Storage::fancy; data(i)->update(info(), base->data[i]); } } diff --git a/src/base/stats/mysql.cc b/src/base/stats/mysql.cc index 72f31240d..58c620ed1 100644 --- a/src/base/stats/mysql.cc +++ b/src/base/stats/mysql.cc @@ -583,8 +583,8 @@ MySql::configure(const DistInfoBase &info) if (!configure(info, "DIST")) return; - if (!info.data.fancy) { - const Params *params = safe_cast(info.storageParams); + const Params *params = safe_cast(info.storageParams); + if (!params->fancy) { stat.size = params->buckets; stat.min = params->min; stat.max = params->max; @@ -599,8 +599,8 @@ MySql::configure(const VectorDistInfoBase &info) if (!configure(info, "VECTORDIST")) return; - if (!info.data[0].fancy) { - const Params *params = safe_cast(info.storageParams); + const Params *params = safe_cast(info.storageParams); + if (!params->fancy) { stat.size = params->buckets; stat.min = params->min; stat.max = params->max; diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc index 3a00620c7..6c2078bd0 100644 --- a/src/base/stats/text.cc +++ b/src/base/stats/text.cc @@ -673,12 +673,11 @@ Text::visit(const DistInfoBase &info) print.squares = data.squares; print.samples = data.samples; - print.fancy = data.fancy; - - if (!data.fancy) { - const DistStor::Params *params = - safe_cast(info.storageParams); + const DistStor::Params *params = + safe_cast(info.storageParams); + print.fancy = params->fancy; + if (!params->fancy) { print.min = params->min; print.max = params->max; print.bucket_size = params->bucket_size; @@ -716,11 +715,11 @@ Text::visit(const VectorDistInfoBase &info) print.squares = info.data[i].squares; print.samples = info.data[i].samples; - print.fancy = info.data[i].fancy; - if (!print.fancy) { - const DistStor::Params *params = - safe_cast(info.storageParams); + const DistStor::Params *params = + safe_cast(info.storageParams); + print.fancy = params->fancy; + if (!params->fancy) { print.min = params->min; print.max = params->max; print.bucket_size = params->bucket_size; -- 2.30.2