summaryrefslogtreecommitdiff
path: root/sim/sim_object.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2003-11-05 18:21:18 -0500
committerNathan Binkert <binkertn@umich.edu>2003-11-05 18:21:18 -0500
commitb064b8a6fda1dd3f1bd174d742cc8e452f714efe (patch)
treedb54b441530115c9d1e20ebe929bb12de5252843 /sim/sim_object.cc
parent9471a4d20ffa98ae3f83edbe8cad1d282ab328af (diff)
downloadgem5-b064b8a6fda1dd3f1bd174d742cc8e452f714efe.tar.xz
Add a virtual function resetStats() that any SimObject can inherit
from that will get called any time stats are reset. sim/sim_object.cc: sim/sim_object.hh: add a virtual function resetStats that any simObject can reset when a statistics reset is initiated --HG-- extra : convert_revision : fdad673142f6ff811f84c246d80e5d41e3c9d4d1
Diffstat (limited to 'sim/sim_object.cc')
-rw-r--r--sim/sim_object.cc30
1 files changed, 27 insertions, 3 deletions
diff --git a/sim/sim_object.cc b/sim/sim_object.cc
index af6a258ff..5c8e3eb9b 100644
--- a/sim/sim_object.cc
+++ b/sim/sim_object.cc
@@ -28,12 +28,13 @@
#include <assert.h>
-#include "sim/sim_object.hh"
+#include "base/callback.hh"
#include "base/inifile.hh"
-#include "sim/configfile.hh"
-#include "sim/host.hh"
#include "base/misc.hh"
#include "base/trace.hh"
+#include "sim/configfile.hh"
+#include "sim/host.hh"
+#include "sim/sim_object.hh"
#include "sim/sim_stats.hh"
using namespace std;
@@ -72,6 +73,21 @@ SimObject::regFormulas()
{
}
+namespace {
+ class __SimObjectResetCB : public Callback
+ {
+ public:
+ __SimObjectResetCB() { Statistics::RegResetCallback(this); }
+ virtual void process() { SimObject::resetAllStats(); }
+ };
+ __SimObjectResetCB __theSimObjectResetCB;
+}
+
+void
+SimObject::resetStats()
+{
+}
+
//
// no default extra output
//
@@ -110,6 +126,14 @@ SimObject::regAllStats()
}
//
+// static function: call resetStats() on all SimObjects.
+//
+void
+SimObject::resetAllStats()
+{
+}
+
+//
// static function: call printExtraOutput() on all SimObjects.
//
void