more initial checking of stats

base/statistics.cc:
    add more checking to the stats stuff to make sure that
    things are set up correctly
base/stats/statdb.cc:
    Check that bins are only registered once.

--HG--
extra : convert_revision : b0eafe4f584a8587dc3bf48812c632531ca28cb6
This commit is contained in:
Nathan Binkert 2004-07-22 21:31:35 -04:00
parent 2f973954ca
commit 552b954180
2 changed files with 6 additions and 1 deletions

View file

@ -273,7 +273,8 @@ check()
for (i = Database::stats().begin(); i != end; ++i) {
StatData *data = *i;
assert(data);
data->check();
if (!data->check() || !data->baseCheck())
panic("stat check failed for %s\n", data->name);
}
int j = 0;

View file

@ -51,6 +51,10 @@ find(void *stat)
void
regBin(MainBin *bin, const std::string &_name)
{
bin_list_t::iterator i, end = bins().end();
for (i = bins().begin(); i != end; ++i)
if ((*i)->name() == _name)
panic("re-registering bin %s", _name);
bins().push_back(bin);
DPRINTF(Stats, "registering %s\n", _name);
}