summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sim/stat_control.cc31
-rw-r--r--src/sim/stats.hh1
2 files changed, 21 insertions, 11 deletions
diff --git a/src/sim/stat_control.cc b/src/sim/stat_control.cc
index 25c5be104..2dcf4798d 100644
--- a/src/sim/stat_control.cc
+++ b/src/sim/stat_control.cc
@@ -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 @@ statElapsedTicks()
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 @@ initSimStats()
registerResetCallback(&simTicksReset);
}
+void
+initSimStats()
+{
+ static Global global;
+}
+
class _StatEvent : public Event
{
private:
diff --git a/src/sim/stats.hh b/src/sim/stats.hh
index 97251283d..481c36cf6 100644
--- a/src/sim/stats.hh
+++ b/src/sim/stats.hh
@@ -34,6 +34,5 @@
#include "base/statistics.hh"
extern Stats::Formula simSeconds;
-extern Stats::Value simTicks;
#endif // __SIM_SIM_STATS_HH__