diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2003-10-30 19:18:53 -0500 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2003-10-30 19:18:53 -0500 |
commit | 2c451a0ad4df2301fdb13f9adf7754693b56d533 (patch) | |
tree | bfb177d67fbadb5d216e4a887c28c8fa4178be4c /base/statistics.hh | |
parent | 16e0a941c5fec115d214f76bf7a5991ddc45e457 (diff) | |
download | gem5-2c451a0ad4df2301fdb13f9adf7754693b56d533.tar.xz |
Make some general changes to stats package where things either could have been better or were just plain wrong.
statistics.hh:
fix a bug in binning that made bins a fixed size no matter what. add GenBin class that is public but not templatized.
statistics.cc:
change map to statMap so others can use the map<> token without needing ::. also, add a level of GenBin that is public base class for StatBin<>.
base/statistics.cc:
change map to statMap so others can use the map<> token without needing ::. also, add a level of GenBin that is public base class for StatBin<>.
base/statistics.hh:
fix a bug in binning that made bins a fixed size no matter what. add GenBin class that is public but not templatized.
--HG--
extra : convert_revision : 6976a891e414c9515cc5a613157f7cb86ef89008
Diffstat (limited to 'base/statistics.hh')
-rw-r--r-- | base/statistics.hh | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/base/statistics.hh b/base/statistics.hh index c789b07c0..2344b5df5 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -59,6 +59,8 @@ #include "sim/host.hh" +#include "base/cprintf.hh" + // // Un-comment this to enable weirdo-stat debugging // @@ -2145,24 +2147,32 @@ class Temp class BinBase { private: - off_t memsize; char *mem; protected: + off_t memsize; off_t size() const { return memsize; } char *memory(); public: - BinBase(size_t size); + BinBase(); virtual ~BinBase(); - virtual void activate() = 0; - void regBin(BinBase *bin, std::string name); }; } // namespace Detail +class GenBin : public Detail::BinBase +{ + public: + GenBin() : BinBase() {} + virtual ~GenBin() {}; + + virtual void activate() = 0; + void regBin(GenBin *bin, std::string name); +}; + template <class BinType> -struct StatBin : public Detail::BinBase +struct StatBin : public GenBin { private: std::string _name; @@ -2193,9 +2203,13 @@ struct StatBin : public Detail::BinBase return off; } - explicit StatBin(std::string name, size_t size = 1024) : Detail::BinBase(size) { _name = name; this->regBin(this, name); } + explicit StatBin(std::string name) : GenBin() { _name = name; this->regBin(this, name); } char *memory(off_t off) { + if (memsize == -1) { + memsize = CeilPow2((size_t) offset()); + cprintf("this is memsize: %d\n", (uint64_t) memsize); + } assert(offset() <= size()); return Detail::BinBase::memory() + off; } |