summaryrefslogtreecommitdiff
path: root/src/sim/stat_control.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2007-02-17 22:52:32 -0800
committerNathan Binkert <binkertn@umich.edu>2007-02-17 22:52:32 -0800
commite94103397c58ffe05d4c5c7f536edabfb1d6861b (patch)
tree9109a4c2f22b3681c48ab6047c3223e70297db12 /src/sim/stat_control.cc
parent01f32efa4b3c25ad6323ec3e76d756b442a8f419 (diff)
downloadgem5-e94103397c58ffe05d4c5c7f536edabfb1d6861b.tar.xz
Get rid of the Statistics and Statreset ParamContexts, and
expose all of the relevant functionality to python. Clean up the mysql code while we're at it. --HG-- extra : convert_revision : 5b711202a5a452b8875ebefb136a156b65c24279
Diffstat (limited to 'src/sim/stat_control.cc')
-rw-r--r--src/sim/stat_control.cc96
1 files changed, 24 insertions, 72 deletions
diff --git a/src/sim/stat_control.cc b/src/sim/stat_control.cc
index 3fad8beb5..228c83898 100644
--- a/src/sim/stat_control.cc
+++ b/src/sim/stat_control.cc
@@ -38,14 +38,9 @@
#include "base/callback.hh"
#include "base/hostinfo.hh"
#include "base/statistics.hh"
-#include "base/str.hh"
#include "base/time.hh"
-#include "base/stats/output.hh"
#include "cpu/base.hh"
#include "sim/eventq.hh"
-#include "sim/sim_object.hh"
-#include "sim/stat_control.hh"
-#include "sim/root.hh"
using namespace std;
@@ -63,11 +58,9 @@ namespace Stats {
Time statTime(true);
Tick startTick;
-Tick lastDump(0);
-class SimTicksReset : public Callback
+struct SimTicksReset : public Callback
{
- public:
void process()
{
statTime.set();
@@ -92,7 +85,7 @@ statElapsedTicks()
SimTicksReset simTicksReset;
void
-InitSimStats()
+initSimStats()
{
simInsts
.functor(BaseCPU::numSimulatedInstructions)
@@ -153,81 +146,40 @@ InitSimStats()
registerResetCallback(&simTicksReset);
}
-class StatEvent : public Event
+class _StatEvent : public Event
{
- protected:
- int flags;
+ private:
+ bool dump;
+ bool reset;
Tick repeat;
public:
- StatEvent(EventQueue *queue, int _flags, Tick _when, Tick _repeat);
- virtual void process();
- virtual const char *description();
-};
-
-StatEvent::StatEvent(EventQueue *queue, int _flags, Tick _when, Tick _repeat)
- : Event(queue, Stat_Event_Pri),
- flags(_flags), repeat(_repeat)
-{
- setFlags(AutoDelete);
- schedule(_when);
-}
-
-const char *
-StatEvent::description()
-{
- return "Statistics dump and/or reset";
-}
-
-void
-StatEvent::process()
-{
- if (flags & Stats::Dump)
- DumpNow();
-
- if (flags & Stats::Reset) {
- cprintf("Resetting stats at cycle %d!\n", curTick);
- reset();
+ _StatEvent(bool _dump, bool _reset, Tick _when, Tick _repeat)
+ : Event(&mainEventQueue, Stat_Event_Pri), dump(_dump), reset(_reset),
+ repeat(_repeat)
+ {
+ setFlags(AutoDelete);
+ schedule(_when);
}
- if (repeat)
- schedule(curTick + repeat);
-}
+ virtual void
+ process()
+ {
+ if (dump)
+ Stats::dump();
-list<Output *> OutputList;
+ if (reset)
+ Stats::reset();
-void
-DumpNow()
-{
- assert(lastDump <= curTick);
- if (lastDump == curTick)
- return;
- lastDump = curTick;
-
- list<Output *>::iterator i = OutputList.begin();
- list<Output *>::iterator end = OutputList.end();
- for (; i != end; ++i) {
- Output *output = *i;
- if (!output->valid())
- continue;
-
- output->output();
+ if (repeat)
+ new _StatEvent(dump, reset, curTick + repeat, repeat);
}
-}
+};
void
-SetupEvent(int flags, Tick when, Tick repeat, EventQueue *queue)
+StatEvent(bool dump, bool reset, Tick when, Tick repeat)
{
- if (queue == NULL)
- queue = &mainEventQueue;
-
- new StatEvent(queue, flags, when, repeat);
+ new _StatEvent(dump, reset, when, repeat);
}
/* namespace Stats */ }
-
-void debugDumpStats()
-{
- Stats::DumpNow();
-}
-