From d1e12b57ce06990a0daf9c295c688795bf62f7cf Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sat, 22 Nov 2003 15:07:53 -0500 Subject: We only need to choose that we do want binning, or we don't. no need for multiple bin classes. If multiple bins are needed, we can always do it with ini type config instead. kern/tru64/tru64_events.hh: sim/system.cc: sim/system.hh: No more GenBin always use MainBin --HG-- extra : convert_revision : 8c466f302324c33b59d47d0da04583b2517fc72c --- base/statistics.cc | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'base/statistics.cc') diff --git a/base/statistics.cc b/base/statistics.cc index b08715162..94b8852f8 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -129,8 +129,8 @@ class Database typedef list list_t; typedef map map_t; - list bins; - map bin_names; + list bins; + map bin_names; list_t binnedStats; list_t allStats; @@ -148,7 +148,7 @@ class Database void reset(); void regStat(Stat *stat); StatData *print(Stat *stat); - void regBin(GenBin *bin, std::string name); + void regBin(MainBin *bin, std::string name); }; Database::Database() @@ -171,14 +171,14 @@ Database::dump(ostream &stream) } #endif //FS_MEASURE - list::iterator j = bins.begin(); - list::iterator bins_end=bins.end(); + list::iterator j = bins.begin(); + list::iterator bins_end=bins.end(); if (!bins.empty()) { ccprintf(stream, "PRINTING BINNED STATS\n"); while (j != bins_end) { (*j)->activate(); - map::const_iterator iter; + map::const_iterator iter; iter = bin_names.find(*j); if (iter == bin_names.end()) panic("a binned stat not found in names map!"); @@ -274,10 +274,10 @@ Database::reset() MainBin *orig = MainBin::curBin(); - list::iterator bi = bins.begin(); - list::iterator be = bins.end(); + list::iterator bi = bins.begin(); + list::iterator be = bins.end(); while (bi != be) { - GenBin *bin = *bi; + MainBin *bin = *bi; bin->activate(); i = allStats.begin(); @@ -308,7 +308,7 @@ Database::regStat(Stat *stat) } void -Database::regBin(GenBin *bin, std::string name) +Database::regBin(MainBin *bin, std::string name) { if (bin_names.find(bin) != bin_names.end()) panic("shouldn't register bin twice"); @@ -910,36 +910,35 @@ FancyDisplay(ostream &stream, const string &name, const string &desc, PrintOne(stream, total, "**Ignore: " + name + NAMESEP + "TOT", desc, precision, flags); } -BinBase::BinBase() - : mem(NULL), memsize(-1) +} // namespace Detail + +MainBin::MainBin(const std::string &name) + : _name(name), mem(NULL), memsize(-1) { + Detail::StatDB().regBin(this, name); } -BinBase::~BinBase() +MainBin::~MainBin() { if (mem) delete [] mem; } char * -BinBase::memory() +MainBin::memory(off_t off) { if (!mem) { mem = new char[memsize]; memset(mem, 0, memsize); } - return mem; -} + if (memsize == -1) + memsize = CeilPow2((size_t) offset()); -void -GenBin::regBin(GenBin *bin, std::string name) -{ - Detail::StatDB().regBin(bin, name); + assert(offset() <= size()); + return mem + off; } -} // namespace Detail - void check() { -- cgit v1.2.3