changeset c810b7d4383d in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=c810b7d4383d
description:
        stats: cleanup static stats to make startup work.
        This is mainly to allow the unit test to run without requiring the 
standard
        M5 stats from being initialized (e.g. sim_seconds, sim_ticks, 
host_seconds)

diffstat:

2 files changed, 21 insertions(+), 11 deletions(-)
src/sim/stat_control.cc |   31 +++++++++++++++++++++----------
src/sim/stats.hh        |    1 -

diffs (65 lines):

diff -r 5a047c3f3795 -r c810b7d4383d src/sim/stat_control.cc
--- a/src/sim/stat_control.cc   Mon Feb 23 11:48:40 2009 -0800
+++ b/src/sim/stat_control.cc   Mon Feb 23 12:03:06 2009 -0800
@@ -44,14 +44,6 @@
 
 using namespace std;
 
-Stats::Formula hostInstRate;
-Stats::Formula hostTickRate;
-Stats::Value hostMemory;
-Stats::Value hostSeconds;
-
-Stats::Value simTicks;
-Stats::Value simInsts;
-Stats::Value simFreq;
 Stats::Formula simSeconds;
 
 namespace Stats {
@@ -84,8 +76,21 @@
 
 SimTicksReset simTicksReset;
 
-void
-initSimStats()
+struct Global
+{
+    Stats::Formula hostInstRate;
+    Stats::Formula hostTickRate;
+    Stats::Value hostMemory;
+    Stats::Value hostSeconds;
+
+    Stats::Value simTicks;
+    Stats::Value simInsts;
+    Stats::Value simFreq;
+
+    Global();
+};
+
+Global::Global()
 {
     simInsts
         .functor(BaseCPU::numSimulatedInstructions)
@@ -146,6 +151,12 @@
     registerResetCallback(&simTicksReset);
 }
 
+void
+initSimStats()
+{
+    static Global global;
+}
+
 class _StatEvent : public Event
 {
   private:
diff -r 5a047c3f3795 -r c810b7d4383d src/sim/stats.hh
--- a/src/sim/stats.hh  Mon Feb 23 11:48:40 2009 -0800
+++ b/src/sim/stats.hh  Mon Feb 23 12:03:06 2009 -0800
@@ -34,6 +34,5 @@
 #include "base/statistics.hh"
 
 extern Stats::Formula simSeconds;
-extern Stats::Value simTicks;
 
 #endif // __SIM_SIM_STATS_HH__
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to