diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/serialize.cc | 36 | ||||
-rw-r--r-- | sim/stat_control.cc | 4 |
2 files changed, 39 insertions, 1 deletions
diff --git a/sim/serialize.cc b/sim/serialize.cc index c4ef124bb..1827a617e 100644 --- a/sim/serialize.cc +++ b/sim/serialize.cc @@ -49,6 +49,9 @@ #include "sim/sim_exit.hh" #include "sim/sim_object.hh" +// For stat reset hack +#include "sim/stat_control.hh" + using namespace std; int Serializable::ckptMaxCount = 0; @@ -482,3 +485,36 @@ Checkpoint::sectionExists(const std::string §ion) { return db->sectionExists(section); } + +/** Hacked stat reset event */ + +class StatresetParamContext : public ParamContext +{ + public: + StatresetParamContext(const string §ion); + ~StatresetParamContext(); + void startup(); +}; + +StatresetParamContext statParams("statsreset"); + +Param<Tick> reset_cycle(&statParams, "reset_cycle", + "Cycle to reset stats on", 0); + +StatresetParamContext::StatresetParamContext(const string §ion) + : ParamContext(section) +{ } + +StatresetParamContext::~StatresetParamContext() +{ +} + +void +StatresetParamContext::startup() +{ + if (reset_cycle > 0) { + Stats::SetupEvent(Stats::Reset, curTick + reset_cycle, 0); + cprintf("Stats reset event scheduled for %lli\n", + curTick + reset_cycle); + } +} diff --git a/sim/stat_control.cc b/sim/stat_control.cc index 85c405b7f..e4394cfa3 100644 --- a/sim/stat_control.cc +++ b/sim/stat_control.cc @@ -183,8 +183,10 @@ StatEvent::process() if (flags & Stats::Dump) DumpNow(); - if (flags & Stats::Reset) + if (flags & Stats::Reset) { + cprintf("Resetting stats!\n"); reset(); + } if (repeat) schedule(curTick + repeat); |