summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2003-11-06 00:41:14 -0500
committerNathan Binkert <binkertn@umich.edu>2003-11-06 00:41:14 -0500
commit655e9ef3de65ce71f63fce23152de862994c38f3 (patch)
tree2dcf58807391d686bf38a600aeffd2fc1c290bd0 /sim
parent22658f20987208463bd1f8c2ba88f59374dcca66 (diff)
downloadgem5-655e9ef3de65ce71f63fce23152de862994c38f3.tar.xz
Little fixes to make more of the stats reset correctly.
base/statistics.cc: formatting cpu/simple_cpu/simple_cpu.cc: cpu/simple_cpu/simple_cpu.hh: Make numInsts reset by adding a resetStats function sim/sim_object.cc: Register the reset callback in a slightly cleaner way to avoid potential static member constructor ordering issues --HG-- extra : convert_revision : 408073b4b0397fbf9dfd9c548a313f1c8c3fc031
Diffstat (limited to 'sim')
-rw-r--r--sim/sim_object.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/sim/sim_object.cc b/sim/sim_object.cc
index b524d6075..dbc2cf7be 100644
--- a/sim/sim_object.cc
+++ b/sim/sim_object.cc
@@ -73,16 +73,6 @@ SimObject::regFormulas()
{
}
-namespace {
- class __SimObjectResetCB : public Callback
- {
- public:
- __SimObjectResetCB() { Statistics::RegResetCallback(this); }
- virtual void process() { SimObject::resetAllStats(); }
- };
- __SimObjectResetCB __theSimObjectResetCB;
-}
-
void
SimObject::resetStats()
{
@@ -101,6 +91,15 @@ SimObject::printExtraOutput(ostream &os)
// call regStats() on all SimObjects and then regFormulas() on all
// SimObjects.
//
+struct SimObjectResetCB : public Callback
+{
+ virtual void process() { SimObject::resetAllStats(); }
+};
+
+namespace {
+ static SimObjectResetCB StatResetCB;
+}
+
void
SimObject::regAllStats()
{
@@ -122,7 +121,9 @@ SimObject::regAllStats()
cprintf("registering formulas for %s\n", (*i)->name());
#endif
(*i)->regFormulas();
- }
+ }
+
+ Statistics::RegResetCallback(&StatResetCB);
}
//