From 552b9541808a76c8da570e918c14b1435570c6fb Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 22 Jul 2004 21:31:35 -0400 Subject: 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 --- base/statistics.cc | 3 ++- base/stats/statdb.cc | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/base/statistics.cc b/base/statistics.cc index 78012bff7..6e3dae1ef 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -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; diff --git a/base/stats/statdb.cc b/base/stats/statdb.cc index eed3d6296..66871b9f7 100644 --- a/base/stats/statdb.cc +++ b/base/stats/statdb.cc @@ -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); } -- cgit v1.2.3