summaryrefslogtreecommitdiff
path: root/base/statistics.cc
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2003-10-21 23:56:31 -0400
committerLisa Hsu <hsul@eecs.umich.edu>2003-10-21 23:56:31 -0400
commit66f115a2df61ab56e5ede8ba31836e20c622e0b3 (patch)
treea3d88388966c8e045c70854f274349e6f508e32c /base/statistics.cc
parent4489583dfe8e173d9d1134838287ac47f9e7140e (diff)
downloadgem5-66f115a2df61ab56e5ede8ba31836e20c622e0b3.tar.xz
statistics.hh:
same - bin printing statistics.cc: printing of bins! now all the nice binning functionality is actually useful cuz you can see the data it so nicely took. this prints out only the individual bin values. totals to come. statistics.hh: add a binned() function to each stat so that at print time, we can know if it's binned in order to print it right. base/statistics.hh: add a binned() function to each stat so that at print time, we can know if it's binned in order to print it right. base/statistics.cc: printing of bins! now all the nice binning functionality is actually useful cuz you can see the data it so nicely took. this prints out only the individual bin values. totals to come. base/statistics.hh: same - bin printing --HG-- extra : convert_revision : 09df9aae62b0e522230ee6bedcb51079346735a4
Diffstat (limited to 'base/statistics.cc')
-rw-r--r--base/statistics.cc69
1 files changed, 66 insertions, 3 deletions
diff --git a/base/statistics.cc b/base/statistics.cc
index abebcae53..a564ce4be 100644
--- a/base/statistics.cc
+++ b/base/statistics.cc
@@ -131,6 +131,10 @@ 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_t binnedStats;
+
list_t allStats;
list_t printStats;
map_t map;
@@ -145,6 +149,7 @@ class Database
void check();
void regStat(Stat *stat);
StatData *print(Stat *stat);
+ void regBin(BinBase *bin, std::string name);
};
Database::Database()
@@ -156,15 +161,51 @@ Database::~Database()
void
Database::dump(ostream &stream)
{
+
list_t::iterator i = printStats.begin();
list_t::iterator end = printStats.end();
-
while (i != end) {
Stat *stat = *i;
- if (stat->dodisplay())
- stat->display(stream);
+ if (stat->binned())
+ binnedStats.push_back(stat);
++i;
}
+
+ list<BinBase *>::iterator j = bins.begin();
+ list<BinBase *>::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;
+ iter = bin_names.find(*j);
+ if (iter == bin_names.end())
+ panic("a binned stat not found in names map!");
+ ccprintf(stream,"---%s Bin------------\n", (*iter).second);
+
+ list_t::iterator i = binnedStats.begin();
+ list_t::iterator end = binnedStats.end();
+ while (i != end) {
+ Stat *stat = *i;
+ if (stat->dodisplay())
+ stat->display(stream);
+ ++i;
+ }
+ ++j;
+ ccprintf(stream, "---------------------------------\n");
+ }
+ }
+
+ list_t::iterator k = printStats.begin();
+ list_t::iterator endprint = printStats.end();
+ ccprintf(stream, "*****ALL STATS*****\n");
+ while (k != endprint) {
+ Stat *stat = *k;
+ if (stat->dodisplay() && !stat->binned())
+ stat->display(stream);
+ ++k;
+ }
}
StatData *
@@ -221,6 +262,21 @@ Database::regStat(Stat *stat)
assert(success && "this should never fail");
}
+void
+Database::regBin(BinBase *bin, std::string name)
+{
+ if (bin_names.find(bin) != bin_names.end())
+ panic("shouldn't register bin twice");
+
+ bins.push_back(bin);
+
+ bool success = (bin_names.insert(make_pair(bin,name))).second;
+ assert(bin_names.find(bin) != bin_names.end());
+ assert(success && "this should not fail");
+
+ cprintf("registering %s\n", name);
+}
+
bool
Stat::less(Stat *stat1, Stat *stat2)
{
@@ -274,6 +330,7 @@ Stat::Stat(bool reg)
if (reg)
StatDB().regStat(this);
+
#ifdef STAT_DEBUG
number = ++total_stats;
cprintf("I'm stat number %d\n",number);
@@ -828,6 +885,12 @@ BinBase::memory()
return mem;
}
+void
+BinBase::regBin(BinBase *bin, std::string name)
+{
+ StatDB().regBin(bin, name);
+}
+
} // namespace Detail
void