summaryrefslogtreecommitdiff
path: root/base/statistics.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2003-10-20 23:08:27 -0400
committerNathan Binkert <binkertn@umich.edu>2003-10-20 23:08:27 -0400
commit02bacb2dfdfcb3161f8fbada4bf3108566989fcd (patch)
treef3db2a424695f8634fdc70e51e35c21a0721f306 /base/statistics.cc
parentdf488c0e70eb827d895c12aba85d5de168505b02 (diff)
downloadgem5-02bacb2dfdfcb3161f8fbada4bf3108566989fcd.tar.xz
Implement reset for stats.
base/statistics.cc: base/statistics.hh: Implement a reset for for the statistics package. This will cause all stats to be set to their default value. Only the currently enabled bin will be reset. test/Makefile: Make tests work again now that we're naming include dirs explicitly test/stattest.cc: test reset --HG-- extra : convert_revision : 8d21cedf6ee91ed0a2412042ea5cb12f79b90eb3
Diffstat (limited to 'base/statistics.cc')
-rw-r--r--base/statistics.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/base/statistics.cc b/base/statistics.cc
index abebcae53..2f52314b9 100644
--- a/base/statistics.cc
+++ b/base/statistics.cc
@@ -35,6 +35,7 @@
#include <math.h>
+#include "base/callback.hh"
#include "base/cprintf.hh"
#include "base/intmath.hh"
#include "base/misc.hh"
@@ -143,6 +144,7 @@ class Database
StatData *find(const Stat *stat);
void check();
+ void reset();
void regStat(Stat *stat);
StatData *print(Stat *stat);
};
@@ -208,6 +210,18 @@ Database::check()
}
void
+Database::reset()
+{
+ list_t::iterator i = allStats.begin();
+ list_t::iterator end = allStats.end();
+
+ while (i != end) {
+ (*i)->reset();
+ ++i;
+ }
+}
+
+void
Database::regStat(Stat *stat)
{
if (map.find(stat) != map.end())
@@ -842,4 +856,19 @@ dump(ostream &stream)
Detail::StatDB().dump(stream);
}
+CallbackQueue resetQueue;
+
+void
+regReset(Callback *cb)
+{
+ resetQueue.add(cb);
+}
+
+void
+reset()
+{
+ Detail::StatDB().reset();
+ resetQueue.process();
+}
+
} // namespace Statistics