/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2004 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <string>
-#include "cpu.hh"
-#include "eventq.hh"
-#include "hostinfo.hh"
-#include "sim_events.hh"
-#include "sim_exit.hh"
-#include "sim_stats.hh"
+#include "base/callback.hh"
+#include "base/hostinfo.hh"
+#include "sim/eventq.hh"
+#include "sim/param.hh"
+#include "sim/sim_events.hh"
+#include "sim/sim_exit.hh"
+#include "sim/startup.hh"
+#include "sim/stats.hh"
using namespace std;
return "simulation termination";
}
-
//
// constructor: automatically schedules at specified time
//
CountedExitEvent::CountedExitEvent(EventQueue *q, const std::string &_cause,
Tick _when, int &_downCounter)
- : Event(q),
+ : Event(q, Sim_Exit_Pri),
cause(_cause),
downCounter(_downCounter)
{
// catch stupid mistakes
assert(downCounter > 0);
- schedule(_when, 1000);
+ schedule(_when);
}
CountedExitEvent::process()
{
if (--downCounter == 0) {
- new SimExitEvent(cause, 1);
+ new SimExitEvent(cause, 0);
}
}
return "counted exit";
}
-
-void
-DumpStatsEvent::process()
-{
- dumpStats();
-}
-
-const char *
-DumpStatsEvent::description()
-{
- return "stats dump";
-}
-
-
#ifdef CHECK_SWAP_CYCLES
new CheckSwapEvent(&mainEventQueue, CHECK_SWAP_CYCLES);
#endif
}
-class DumpStatsContext : public ParamContext
-{
- public:
- DumpStatsContext(const string &_iniSection)
- : ParamContext(_iniSection) {}
- void checkParams();
-};
-
-DumpStatsContext dumpStatsParams("stats");
-
-VectorParam<Tick> dump_cycle(&dumpStatsParams, "dump_cycles",
- "cycles on which to dump stats");
-
-void
-DumpStatsContext::checkParams()
-{
- if (dump_cycle.isValid()) {
- vector<Tick> &cycles = dump_cycle;
-
- vector<Tick>::iterator i = cycles.begin();
- vector<Tick>::iterator end = cycles.end();
-
- for (; i < end; ++i)
- new DumpStatsEvent(*i);
- }
-}
-
///////////////////////////////////////////////////
//
// Simulation termination parameters
ProgressEvent::ProgressEvent(EventQueue *q, Tick _interval)
: Event(q), interval(_interval)
{
- schedule(interval);
+ schedule(curTick + interval);
}
//
// Parameter space for execution address tracing options. Derive
// from ParamContext so we can override checkParams() function.
-class ProgressParamContext : public ParamContext
+struct ProgressParamContext : public ParamContext
{
- public:
ProgressParamContext(const string &_iniSection)
: ParamContext(_iniSection) {}
- void checkParams();
+ void startup();
};
ProgressParamContext progessMessageParams("progress");
Param<Tick> progress_interval(&progessMessageParams, "cycle",
"cycle interval for progress messages");
-/* check execute options */
void
-ProgressParamContext::checkParams()
+ProgressParamContext::startup()
{
if (progress_interval.isValid())
new ProgressEvent(&mainEventQueue, progress_interval);