68c68
< #include "base/stats/visit.hh"
---
> #include "base/stats/info.hh"
69a70
> #include "base/stats/visit.hh"
80,165d80
< struct StorageParams
< {
< virtual ~StorageParams();
< };
<
< //////////////////////////////////////////////////////////////////////
< //
< // Statistics Framework Base classes
< //
< //////////////////////////////////////////////////////////////////////
< class Info
< {
< public:
< /** The name of the stat. */
< std::string name;
< /** The description of the stat. */
< std::string desc;
< /** The formatting flags. */
< StatFlags flags;
< /** The display precision. */
< int precision;
< /** A pointer to a prerequisite Stat. */
< const Info *prereq;
< /**
< * A unique stat ID for each stat in the simulator.
< * Can be used externally for lookups as well as for debugging.
< */
< static int id_count;
< int id;
<
< public:
< const StorageParams *storageParams;
<
< public:
< Info();
< virtual ~Info();
<
< /** Set the name of this statistic */
< void setName(const std::string &name);
<
< /**
< * Check that this stat has been set up properly and is ready for
< * use
< * @return true for success
< */
< virtual bool check() const = 0;
< bool baseCheck() const;
<
< /**
< * Enable the stat for use
< */
< virtual void enable();
<
< /**
< * Prepare the stat for dumping.
< */
< virtual void prepare() = 0;
<
< /**
< * Reset the stat to the default state.
< */
< virtual void reset() = 0;
<
< /**
< * @return true if this stat has a value and satisfies its
< * requirement as a prereq
< */
< virtual bool zero() const = 0;
<
< /**
< * Visitor entry for outputing statistics data
< */
< virtual void visit(Visit &visitor) = 0;
<
< /**
< * Checks if the first stat's name is alphabetically less than the second.
< * This function breaks names up at periods and considers each subname
< * separately.
< * @param stat1 The first stat.
< * @param stat2 The second stat.
< * @return stat1's name is alphabetically before stat2's
< */
< static bool less(Info *stat1, Info *stat2);
< };
< struct StorageParams;
<
186,193d100
< class ScalarInfo : public Info
< {
< public:
< virtual Counter value() const = 0;
< virtual Result result() const = 0;
< virtual Result total() const = 0;
< };
<
205,221d111
< class VectorInfo : public Info
< {
< public:
< /** Names and descriptions of subfields. */
< std::vector<std::string> subnames;
< std::vector<std::string> subdescs;
<
< public:
< void enable();
<
< public:
< virtual size_type size() const = 0;
< virtual const VCounter &value() const = 0;
< virtual const VResult &result() const = 0;
< virtual Result total() const = 0;
< };
<
251,269d140
< struct DistData
< {
< Counter min_val;
< Counter max_val;
< Counter underflow;
< Counter overflow;
< VCounter cvec;
< Counter sum;
< Counter squares;
< Counter samples;
< };
<
< class DistInfo : public Info
< {
< public:
< /** Local storage for the entry values, used for printing. */
< DistData data;
< };
<
277,294d147
< class VectorDistInfo : public Info
< {
< public:
< std::vector<DistData> data;
<
< /** Names and descriptions of subfields. */
< std::vector<std::string> subnames;
< std::vector<std::string> subdescs;
< void enable();
<
< protected:
< /** Local storage for the entry values, used for printing. */
< mutable VResult rvec;
<
< public:
< virtual size_type size() const = 0;
< };
<
304,320d156
< class Vector2dInfo : public Info
< {
< public:
< /** Names and descriptions of subfields. */
< std::vector<std::string> subnames;
< std::vector<std::string> subdescs;
< std::vector<std::string> y_subnames;
<
< size_type x;
< size_type y;
<
< /** Local storage for the entry values, used for printing. */
< mutable VCounter cvec;
<
< void enable();
< };
<
1430,1445d1265
< struct DistParams : public StorageParams
< {
< const bool fancy;
<
< /** The minimum value to track. */
< Counter min;
< /** The maximum value to track. */
< Counter max;
< /** The number of entries in each bucket. */
< Counter bucket_size;
< /** The number of buckets. Equal to (max-min)/bucket_size. */
< size_type buckets;
<
< explicit DistParams(bool f) : fancy(f) {}
< };
<
2558,2563d2377
< class FormulaInfo : public VectorInfo
< {
< public:
< virtual std::string str() const = 0;
< };
<