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)
This commit is contained in:
Nathan Binkert
2009-02-23 12:03:06 -08:00
parent 3fa9812e1d
commit f69ea20fc6
2 changed files with 21 additions and 11 deletions

View File

@@ -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:

View File

@@ -34,6 +34,5 @@
#include "base/statistics.hh"
extern Stats::Formula simSeconds;
extern Stats::Value simTicks;
#endif // __SIM_SIM_STATS_HH__