summaryrefslogtreecommitdiff
path: root/base/statistics.cc
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2003-10-30 19:18:53 -0500
committerLisa Hsu <hsul@eecs.umich.edu>2003-10-30 19:18:53 -0500
commit2c451a0ad4df2301fdb13f9adf7754693b56d533 (patch)
treebfb177d67fbadb5d216e4a887c28c8fa4178be4c /base/statistics.cc
parent16e0a941c5fec115d214f76bf7a5991ddc45e457 (diff)
downloadgem5-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.cc')
-rw-r--r--base/statistics.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/base/statistics.cc b/base/statistics.cc
index cde98d861..184fa67a9 100644
--- a/base/statistics.cc
+++ b/base/statistics.cc
@@ -132,13 +132,13 @@ class Database
typedef list<Stat *> list_t;
typedef map<const Stat *, StatData *> map_t;
- list<BinBase *> bins;
- map<const BinBase *, std::string > bin_names;
+ list<GenBin *> bins;
+ map<const GenBin *, std::string > bin_names;
list_t binnedStats;
list_t allStats;
list_t printStats;
- map_t map;
+ map_t statMap;
public:
Database();
@@ -151,7 +151,7 @@ class Database
void reset();
void regStat(Stat *stat);
StatData *print(Stat *stat);
- void regBin(BinBase *bin, std::string name);
+ void regBin(GenBin *bin, std::string name);
};
Database::Database()
@@ -173,14 +173,14 @@ Database::dump(ostream &stream)
++i;
}
- list<BinBase *>::iterator j = bins.begin();
- list<BinBase *>::iterator bins_end=bins.end();
+ list<GenBin *>::iterator j = bins.begin();
+ list<GenBin *>::iterator bins_end=bins.end();
if (!bins.empty()) {
ccprintf(stream, "PRINTING BINNED STATS\n");
while (j != bins_end) {
(*j)->activate();
- ::map<const BinBase *, std::string>::const_iterator iter;
+ map<const GenBin *, std::string>::const_iterator iter;
iter = bin_names.find(*j);
if (iter == bin_names.end())
panic("a binned stat not found in names map!");
@@ -213,9 +213,9 @@ Database::dump(ostream &stream)
StatData *
Database::find(const Stat *stat)
{
- map_t::const_iterator i = map.find(stat);
+ map_t::const_iterator i = statMap.find(stat);
- if (i == map.end())
+ if (i == statMap.end())
return NULL;
return (*i).second;
@@ -265,19 +265,19 @@ Database::reset()
void
Database::regStat(Stat *stat)
{
- if (map.find(stat) != map.end())
+ if (statMap.find(stat) != statMap.end())
panic("shouldn't register stat twice!");
allStats.push_back(stat);
StatData *data = new StatData;
- bool success = (map.insert(make_pair(stat, data))).second;
- assert(map.find(stat) != map.end());
+ bool success = (statMap.insert(make_pair(stat, data))).second;
+ assert(statMap.find(stat) != statMap.end());
assert(success && "this should never fail");
}
void
-Database::regBin(BinBase *bin, std::string name)
+Database::regBin(GenBin *bin, std::string name)
{
if (bin_names.find(bin) != bin_names.end())
panic("shouldn't register bin twice");
@@ -877,8 +877,8 @@ FancyDisplay(ostream &stream, const string &name, const string &desc,
PrintOne(stream, stdev, name + NAMESEP + "stdev", desc, precision, flags);
}
-BinBase::BinBase(size_t size)
- : memsize(CeilPow2(size)), mem(NULL)
+BinBase::BinBase()
+ : mem(NULL), memsize(-1)
{
}
@@ -900,9 +900,9 @@ BinBase::memory()
}
void
-BinBase::regBin(BinBase *bin, std::string name)
+GenBin::regBin(GenBin *bin, std::string name)
{
- StatDB().regBin(bin, name);
+ Detail::StatDB().regBin(bin, name);
}
} // namespace Detail