diff options
author | Nathan Binkert <nate@binkert.org> | 2009-04-22 13:38:00 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2009-04-22 13:38:00 -0700 |
commit | 4d9f25b75cf09760f008cdb393f54a2e5d0029c7 (patch) | |
tree | ed76722a06999a7746e78ead65f55abc95795d62 /src | |
parent | 567cab685965e4e627ac1541a9fdacb93fd6e5fe (diff) | |
download | gem5-4d9f25b75cf09760f008cdb393f54a2e5d0029c7.tar.xz |
stats: Rename the info classes to hopefully make things a bit clearer
FooInfoBase became FooInfo
FooInfo became FooInfoProxy
Diffstat (limited to 'src')
-rw-r--r-- | src/base/statistics.cc | 6 | ||||
-rw-r--r-- | src/base/statistics.hh | 95 | ||||
-rw-r--r-- | src/base/stats/mysql.cc | 36 | ||||
-rw-r--r-- | src/base/stats/mysql.hh | 40 | ||||
-rw-r--r-- | src/base/stats/text.cc | 22 | ||||
-rw-r--r-- | src/base/stats/text.hh | 12 | ||||
-rw-r--r-- | src/base/stats/visit.hh | 26 |
7 files changed, 119 insertions, 118 deletions
diff --git a/src/base/statistics.cc b/src/base/statistics.cc index 1f3562384..8a896f8cd 100644 --- a/src/base/statistics.cc +++ b/src/base/statistics.cc @@ -206,7 +206,7 @@ Info::enable() } void -VectorInfoBase::enable() +VectorInfo::enable() { size_type s = size(); if (subnames.size() < s) @@ -216,7 +216,7 @@ VectorInfoBase::enable() } void -VectorDistInfoBase::enable() +VectorDistInfo::enable() { size_type s = size(); if (subnames.size() < s) @@ -226,7 +226,7 @@ VectorDistInfoBase::enable() } void -Vector2dInfoBase::enable() +Vector2dInfo::enable() { if (subnames.size() < x) subnames.resize(x); diff --git a/src/base/statistics.hh b/src/base/statistics.hh index cd5be21ce..6758a6489 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -161,15 +161,16 @@ class Info */ static bool less(Info *stat1, Info *stat2); }; +struct StorageParams; template <class Stat, class Base> -class InfoWrap : public Base +class InfoProxy : public Base { protected: Stat &s; public: - InfoWrap(Stat &stat) : s(stat) {} + InfoProxy(Stat &stat) : s(stat) {} bool check() const { return s.check(); } void prepare() { s.prepare(); } @@ -182,7 +183,7 @@ class InfoWrap : public Base bool zero() const { return s.zero(); } }; -class ScalarInfoBase : public Info +class ScalarInfo : public Info { public: virtual Counter value() const = 0; @@ -191,17 +192,17 @@ class ScalarInfoBase : public Info }; template <class Stat> -class ScalarInfo : public InfoWrap<Stat, ScalarInfoBase> +class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo> { public: - ScalarInfo(Stat &stat) : InfoWrap<Stat, ScalarInfoBase>(stat) {} + ScalarInfoProxy(Stat &stat) : InfoProxy<Stat, ScalarInfo>(stat) {} Counter value() const { return this->s.value(); } Result result() const { return this->s.result(); } Result total() const { return this->s.total(); } }; -class VectorInfoBase : public Info +class VectorInfo : public Info { public: /** Names and descriptions of subfields. */ @@ -219,14 +220,14 @@ class VectorInfoBase : public Info }; template <class Stat> -class VectorInfo : public InfoWrap<Stat, VectorInfoBase> +class VectorInfoProxy : public InfoProxy<Stat, VectorInfo> { protected: mutable VCounter cvec; mutable VResult rvec; public: - VectorInfo(Stat &stat) : InfoWrap<Stat, VectorInfoBase>(stat) {} + VectorInfoProxy(Stat &stat) : InfoProxy<Stat, VectorInfo>(stat) {} size_type size() const { return this->s.size(); } @@ -259,7 +260,7 @@ struct DistData Counter samples; }; -class DistInfoBase : public Info +class DistInfo : public Info { public: /** Local storage for the entry values, used for printing. */ @@ -267,13 +268,13 @@ class DistInfoBase : public Info }; template <class Stat> -class DistInfo : public InfoWrap<Stat, DistInfoBase> +class DistInfoProxy : public InfoProxy<Stat, DistInfo> { public: - DistInfo(Stat &stat) : InfoWrap<Stat, DistInfoBase>(stat) {} + DistInfoProxy(Stat &stat) : InfoProxy<Stat, DistInfo>(stat) {} }; -class VectorDistInfoBase : public Info +class VectorDistInfo : public Info { public: std::vector<DistData> data; @@ -292,15 +293,15 @@ class VectorDistInfoBase : public Info }; template <class Stat> -class VectorDistInfo : public InfoWrap<Stat, VectorDistInfoBase> +class VectorDistInfoProxy : public InfoProxy<Stat, VectorDistInfo> { public: - VectorDistInfo(Stat &stat) : InfoWrap<Stat, VectorDistInfoBase>(stat) {} + VectorDistInfoProxy(Stat &stat) : InfoProxy<Stat, VectorDistInfo>(stat) {} size_type size() const { return this->s.size(); } }; -class Vector2dInfoBase : public Info +class Vector2dInfo : public Info { public: /** Names and descriptions of subfields. */ @@ -318,10 +319,10 @@ class Vector2dInfoBase : public Info }; template <class Stat> -class Vector2dInfo : public InfoWrap<Stat, Vector2dInfoBase> +class Vector2dInfoProxy : public InfoProxy<Stat, Vector2dInfo> { public: - Vector2dInfo(Stat &stat) : InfoWrap<Stat, Vector2dInfoBase>(stat) {} + Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {} }; class InfoAccess @@ -359,11 +360,11 @@ class InfoAccess bool check() const { return true; } }; -template <class Derived, template <class> class InfoType> +template <class Derived, template <class> class InfoProxyType> class DataWrap : public InfoAccess { public: - typedef InfoType<Derived> Info; + typedef InfoProxyType<Derived> Info; protected: Derived &self() { return *static_cast<Derived *>(this); } @@ -466,11 +467,11 @@ class DataWrap : public InfoAccess } }; -template <class Derived, template <class> class InfoType> -class DataWrapVec : public DataWrap<Derived, InfoType> +template <class Derived, template <class> class InfoProxyType> +class DataWrapVec : public DataWrap<Derived, InfoProxyType> { public: - typedef InfoType<Derived> Info; + typedef InfoProxyType<Derived> Info; // The following functions are specific to vectors. If you use them // in a non vector context, you will get a nice compiler error! @@ -542,11 +543,11 @@ class DataWrapVec : public DataWrap<Derived, InfoType> } }; -template <class Derived, template <class> class InfoType> -class DataWrapVec2d : public DataWrapVec<Derived, InfoType> +template <class Derived, template <class> class InfoProxyType> +class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType> { public: - typedef InfoType<Derived> Info; + typedef InfoProxyType<Derived> Info; /** * @warning This makes the assumption that if you're gonna subnames a 2d @@ -746,7 +747,7 @@ class AvgStor * Storage template. */ template <class Derived, class Stor> -class ScalarBase : public DataWrap<Derived, ScalarInfo> +class ScalarBase : public DataWrap<Derived, ScalarInfoProxy> { public: typedef Stor Storage; @@ -860,7 +861,7 @@ class ScalarBase : public DataWrap<Derived, ScalarInfo> void prepare() { data()->prepare(this->info()); } }; -class ProxyInfo : public ScalarInfoBase +class ProxyInfo : public ScalarInfo { public: std::string str() const { return to_string(value()); } @@ -900,7 +901,7 @@ class FunctorProxy : public ProxyInfo }; template <class Derived> -class ValueBase : public DataWrap<Derived, ScalarInfo> +class ValueBase : public DataWrap<Derived, ScalarInfoProxy> { private: ProxyInfo *proxy; @@ -1076,7 +1077,7 @@ class ScalarProxy * Storage class. @sa ScalarBase */ template <class Derived, class Stor> -class VectorBase : public DataWrapVec<Derived, VectorInfo> +class VectorBase : public DataWrapVec<Derived, VectorInfoProxy> { public: typedef Stor Storage; @@ -1085,7 +1086,7 @@ class VectorBase : public DataWrapVec<Derived, VectorInfo> /** Proxy type */ typedef ScalarProxy<Derived> Proxy; friend class ScalarProxy<Derived>; - friend class DataWrapVec<Derived, VectorInfo>; + friend class DataWrapVec<Derived, VectorInfoProxy>; protected: /** The storage of this stat. */ @@ -1295,17 +1296,17 @@ class VectorProxy }; template <class Derived, class Stor> -class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfo> +class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy> { public: - typedef Vector2dInfo<Derived> Info; + typedef Vector2dInfoProxy<Derived> Info; typedef Stor Storage; typedef typename Stor::Params Params; typedef VectorProxy<Derived> Proxy; friend class ScalarProxy<Derived>; friend class VectorProxy<Derived>; - friend class DataWrapVec<Derived, Vector2dInfo>; - friend class DataWrapVec2d<Derived, Vector2dInfo>; + friend class DataWrapVec<Derived, Vector2dInfoProxy>; + friend class DataWrapVec2d<Derived, Vector2dInfoProxy>; protected: size_type x; @@ -1733,10 +1734,10 @@ class AvgFancy * determined by the Storage template. @sa ScalarBase */ template <class Derived, class Stor> -class DistBase : public DataWrap<Derived, DistInfo> +class DistBase : public DataWrap<Derived, DistInfoProxy> { public: - typedef DistInfo<Derived> Info; + typedef DistInfoProxy<Derived> Info; typedef Stor Storage; typedef typename Stor::Params Params; @@ -1816,15 +1817,15 @@ template <class Stat> class DistProxy; template <class Derived, class Stor> -class VectorDistBase : public DataWrapVec<Derived, VectorDistInfo> +class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy> { public: - typedef VectorDistInfo<Derived> Info; + typedef VectorDistInfoProxy<Derived> Info; typedef Stor Storage; typedef typename Stor::Params Params; typedef DistProxy<Derived> Proxy; friend class DistProxy<Derived>; - friend class DataWrapVec<Derived, VectorDistInfo>; + friend class DataWrapVec<Derived, VectorDistInfoProxy>; protected: Storage *storage; @@ -2027,11 +2028,11 @@ typedef RefCountingPtr<Node> NodePtr; class ScalarStatNode : public Node { private: - const ScalarInfoBase *data; + const ScalarInfo *data; mutable VResult vresult; public: - ScalarStatNode(const ScalarInfoBase *d) : data(d), vresult(1) {} + ScalarStatNode(const ScalarInfo *d) : data(d), vresult(1) {} const VResult & result() const @@ -2094,10 +2095,10 @@ class ScalarProxyNode : public Node class VectorStatNode : public Node { private: - const VectorInfoBase *data; + const VectorInfo *data; public: - VectorStatNode(const VectorInfoBase *d) : data(d) { } + VectorStatNode(const VectorInfo *d) : data(d) { } const VResult &result() const { return data->result(); } Result total() const { return data->total(); }; @@ -2554,21 +2555,21 @@ class VectorAverageDeviation } }; -class FormulaInfoBase : public VectorInfoBase +class FormulaInfo : public VectorInfo { public: virtual std::string str() const = 0; }; template <class Stat> -class FormulaInfo : public InfoWrap<Stat, FormulaInfoBase> +class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo> { protected: mutable VResult vec; mutable VCounter cvec; public: - FormulaInfo(Stat &stat) : InfoWrap<Stat, FormulaInfoBase>(stat) {} + FormulaInfoProxy(Stat &stat) : InfoProxy<Stat, FormulaInfo>(stat) {} size_type size() const { return this->s.size(); } @@ -2590,7 +2591,7 @@ class Temp; * stored as a tree of Nodes that represent the equation to calculate. * @sa Stat, ScalarStat, VectorStat, Node, Temp */ -class Formula : public DataWrapVec<Formula, FormulaInfo> +class Formula : public DataWrapVec<Formula, FormulaInfoProxy> { protected: /** The root of the tree which represents the Formula */ diff --git a/src/base/stats/mysql.cc b/src/base/stats/mysql.cc index 1e0c923f1..dff9a0ee0 100644 --- a/src/base/stats/mysql.cc +++ b/src/base/stats/mysql.cc @@ -544,7 +544,7 @@ MySql::configure(const Info &info, string type) } void -MySql::configure(const ScalarInfoBase &info) +MySql::configure(const ScalarInfo &info) { if (!configure(info, "SCALAR")) return; @@ -553,7 +553,7 @@ MySql::configure(const ScalarInfoBase &info) } void -MySql::configure(const VectorInfoBase &info) +MySql::configure(const VectorInfo &info) { if (!configure(info, "VECTOR")) return; @@ -578,7 +578,7 @@ MySql::configure(const VectorInfoBase &info) } void -MySql::configure(const DistInfoBase &info) +MySql::configure(const DistInfo &info) { if (!configure(info, "DIST")) return; @@ -595,7 +595,7 @@ MySql::configure(const DistInfoBase &info) } void -MySql::configure(const VectorDistInfoBase &info) +MySql::configure(const VectorDistInfo &info) { if (!configure(info, "VECTORDIST")) return; @@ -628,7 +628,7 @@ MySql::configure(const VectorDistInfoBase &info) } void -MySql::configure(const Vector2dInfoBase &info) +MySql::configure(const Vector2dInfo &info) { if (!configure(info, "VECTOR2D")) return; @@ -665,7 +665,7 @@ MySql::configure(const Vector2dInfoBase &info) } void -MySql::configure(const FormulaInfoBase &info) +MySql::configure(const FormulaInfo &info) { MySQL::Connection &mysql = run->conn(); assert(mysql.connected()); @@ -735,7 +735,7 @@ MySql::event(const std::string &event) } void -MySql::output(const ScalarInfoBase &info) +MySql::output(const ScalarInfo &info) { if (!(info.flags & print)) return; @@ -749,7 +749,7 @@ MySql::output(const ScalarInfoBase &info) } void -MySql::output(const VectorInfoBase &info) +MySql::output(const VectorInfo &info) { if (!(info.flags & print)) return; @@ -816,7 +816,7 @@ MySql::output(const DistData &data, const DistParams *params) } void -MySql::output(const DistInfoBase &info) +MySql::output(const DistInfo &info) { if (!(info.flags & print)) return; @@ -827,7 +827,7 @@ MySql::output(const DistInfoBase &info) } void -MySql::output(const VectorDistInfoBase &info) +MySql::output(const VectorDistInfo &info) { if (!(info.flags & print)) return; @@ -843,7 +843,7 @@ MySql::output(const VectorDistInfoBase &info) } void -MySql::output(const Vector2dInfoBase &info) +MySql::output(const Vector2dInfo &info) { if (!(info.flags & print)) return; @@ -862,7 +862,7 @@ MySql::output(const Vector2dInfoBase &info) } void -MySql::output(const FormulaInfoBase &info) +MySql::output(const FormulaInfo &info) { } @@ -870,7 +870,7 @@ MySql::output(const FormulaInfoBase &info) * Implement the visitor */ void -MySql::visit(const ScalarInfoBase &info) +MySql::visit(const ScalarInfo &info) { if (!configured) configure(info); @@ -879,7 +879,7 @@ MySql::visit(const ScalarInfoBase &info) } void -MySql::visit(const VectorInfoBase &info) +MySql::visit(const VectorInfo &info) { if (!configured) configure(info); @@ -888,7 +888,7 @@ MySql::visit(const VectorInfoBase &info) } void -MySql::visit(const DistInfoBase &info) +MySql::visit(const DistInfo &info) { return; if (!configured) @@ -898,7 +898,7 @@ MySql::visit(const DistInfoBase &info) } void -MySql::visit(const VectorDistInfoBase &info) +MySql::visit(const VectorDistInfo &info) { return; if (!configured) @@ -908,7 +908,7 @@ MySql::visit(const VectorDistInfoBase &info) } void -MySql::visit(const Vector2dInfoBase &info) +MySql::visit(const Vector2dInfo &info) { return; if (!configured) @@ -918,7 +918,7 @@ MySql::visit(const Vector2dInfoBase &info) } void -MySql::visit(const FormulaInfoBase &info) +MySql::visit(const FormulaInfo &info) { if (!configured) configure(info); diff --git a/src/base/stats/mysql.hh b/src/base/stats/mysql.hh index 86a4d6d23..45fda2982 100644 --- a/src/base/stats/mysql.hh +++ b/src/base/stats/mysql.hh @@ -40,7 +40,7 @@ namespace MySQL { class Connection; } namespace Stats { -class DistInfoBase; +class DistInfo; class MySqlRun; struct SetupStat @@ -122,7 +122,7 @@ class MySql : public Output SetupStat stat; InsertData newdata; InsertEvent newevent; - std::list<FormulaInfoBase *> formulas; + std::list<FormulaInfo *> formulas; bool configured; protected: @@ -156,12 +156,12 @@ class MySql : public Output public: // Implement Visit - virtual void visit(const ScalarInfoBase &info); - virtual void visit(const VectorInfoBase &info); - virtual void visit(const DistInfoBase &info); - virtual void visit(const VectorDistInfoBase &info); - virtual void visit(const Vector2dInfoBase &info); - virtual void visit(const FormulaInfoBase &info); + virtual void visit(const ScalarInfo &info); + virtual void visit(const VectorInfo &info); + virtual void visit(const DistInfo &info); + virtual void visit(const VectorDistInfo &info); + virtual void visit(const Vector2dInfo &info); + virtual void visit(const FormulaInfo &info); // Implement Output virtual bool valid() const; @@ -172,22 +172,22 @@ class MySql : public Output protected: // Output helper - void output(const ScalarInfoBase &info); - void output(const VectorInfoBase &info); - void output(const DistInfoBase &info); - void output(const VectorDistInfoBase &info); - void output(const Vector2dInfoBase &info); - void output(const FormulaInfoBase &info); + void output(const ScalarInfo &info); + void output(const VectorInfo &info); + void output(const DistInfo &info); + void output(const VectorDistInfo &info); + void output(const Vector2dInfo &info); + void output(const FormulaInfo &info); void output(const DistData &data, const DistParams *params); void configure(); bool configure(const Info &info, std::string type); - void configure(const ScalarInfoBase &info); - void configure(const VectorInfoBase &info); - void configure(const DistInfoBase &info); - void configure(const VectorDistInfoBase &info); - void configure(const Vector2dInfoBase &info); - void configure(const FormulaInfoBase &info); + void configure(const ScalarInfo &info); + void configure(const VectorInfo &info); + void configure(const DistInfo &info); + void configure(const VectorDistInfo &info); + void configure(const Vector2dInfo &info); + void configure(const FormulaInfo &info); }; bool initMySQL(std::string host, std::string database, std::string user, diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc index d218d72e0..8502ec747 100644 --- a/src/base/stats/text.cc +++ b/src/base/stats/text.cc @@ -299,19 +299,19 @@ struct DistPrint const DistData &data; - DistPrint(const Text *text, const DistInfoBase &info); - DistPrint(const Text *text, const VectorDistInfoBase &info, int i); + DistPrint(const Text *text, const DistInfo &info); + DistPrint(const Text *text, const VectorDistInfo &info, int i); void init(const Text *text, const Info &info, const DistParams *params); void operator()(ostream &stream) const; }; -DistPrint::DistPrint(const Text *text, const DistInfoBase &info) +DistPrint::DistPrint(const Text *text, const DistInfo &info) : data(info.data) { init(text, info, safe_cast<const DistParams *>(info.storageParams)); } -DistPrint::DistPrint(const Text *text, const VectorDistInfoBase &info, int i) +DistPrint::DistPrint(const Text *text, const VectorDistInfo &info, int i) : data(info.data[i]) { init(text, info, safe_cast<const DistParams *>(info.storageParams)); @@ -458,7 +458,7 @@ DistPrint::operator()(ostream &stream) const } void -Text::visit(const ScalarInfoBase &info) +Text::visit(const ScalarInfo &info) { if (noOutput(info)) return; @@ -477,7 +477,7 @@ Text::visit(const ScalarInfoBase &info) } void -Text::visit(const VectorInfoBase &info) +Text::visit(const VectorInfo &info) { if (noOutput(info)) return; @@ -515,7 +515,7 @@ Text::visit(const VectorInfoBase &info) } void -Text::visit(const Vector2dInfoBase &info) +Text::visit(const Vector2dInfo &info) { if (noOutput(info)) return; @@ -569,7 +569,7 @@ Text::visit(const Vector2dInfoBase &info) } void -Text::visit(const DistInfoBase &info) +Text::visit(const DistInfo &info) { if (noOutput(info)) return; @@ -579,7 +579,7 @@ Text::visit(const DistInfoBase &info) } void -Text::visit(const VectorDistInfoBase &info) +Text::visit(const VectorDistInfo &info) { if (noOutput(info)) return; @@ -591,9 +591,9 @@ Text::visit(const VectorDistInfoBase &info) } void -Text::visit(const FormulaInfoBase &info) +Text::visit(const FormulaInfo &info) { - visit((const VectorInfoBase &)info); + visit((const VectorInfo &)info); } bool diff --git a/src/base/stats/text.hh b/src/base/stats/text.hh index 9f65454af..04b914ae9 100644 --- a/src/base/stats/text.hh +++ b/src/base/stats/text.hh @@ -61,12 +61,12 @@ class Text : public Output void open(const std::string &file); // Implement Visit - virtual void visit(const ScalarInfoBase &info); - virtual void visit(const VectorInfoBase &info); - virtual void visit(const DistInfoBase &info); - virtual void visit(const VectorDistInfoBase &info); - virtual void visit(const Vector2dInfoBase &info); - virtual void visit(const FormulaInfoBase &info); + virtual void visit(const ScalarInfo &info); + virtual void visit(const VectorInfo &info); + virtual void visit(const DistInfo &info); + virtual void visit(const VectorDistInfo &info); + virtual void visit(const Vector2dInfo &info); + virtual void visit(const FormulaInfo &info); // Implement Output virtual bool valid() const; diff --git a/src/base/stats/visit.hh b/src/base/stats/visit.hh index 9d6996689..89dd57912 100644 --- a/src/base/stats/visit.hh +++ b/src/base/stats/visit.hh @@ -39,25 +39,25 @@ namespace Stats { class Info; -class ScalarInfoBase; -class VectorInfoBase; -class DistInfoBase; -class DistInfoBase; -class VectorDistInfoBase; -class Vector2dInfoBase; -class FormulaInfoBase; +class ScalarInfo; +class VectorInfo; +class DistInfo; +class DistInfo; +class VectorDistInfo; +class Vector2dInfo; +class FormulaInfo; struct Visit { Visit(); virtual ~Visit(); - virtual void visit(const ScalarInfoBase &info) = 0; - virtual void visit(const VectorInfoBase &info) = 0; - virtual void visit(const DistInfoBase &info) = 0; - virtual void visit(const VectorDistInfoBase &info) = 0; - virtual void visit(const Vector2dInfoBase &info) = 0; - virtual void visit(const FormulaInfoBase &info) = 0; + virtual void visit(const ScalarInfo &info) = 0; + virtual void visit(const VectorInfo &info) = 0; + virtual void visit(const DistInfo &info) = 0; + virtual void visit(const VectorDistInfo &info) = 0; + virtual void visit(const Vector2dInfo &info) = 0; + virtual void visit(const FormulaInfo &info) = 0; }; /* namespace Stats */ } |