summaryrefslogtreecommitdiff
path: root/sim/sim_events.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-02-29 18:49:44 -0500
committerNathan Binkert <binkertn@umich.edu>2004-02-29 18:49:44 -0500
commit31f82cef41962fb57d343f4a8cd468c87d8204dc (patch)
tree4df5a577528ad111ac1e8385615b9509805c0dee /sim/sim_events.cc
parent2272164d6652c554fb3bab7bddfd0d53151e4115 (diff)
downloadgem5-31f82cef41962fb57d343f4a8cd468c87d8204dc.tar.xz
Make the progress event work even after restoring from a checkpoint
--HG-- extra : convert_revision : 80e31eb26250700ebe3ce5848e570068cc76ef47
Diffstat (limited to 'sim/sim_events.cc')
-rw-r--r--sim/sim_events.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/sim/sim_events.cc b/sim/sim_events.cc
index a31da18dd..f7b07359c 100644
--- a/sim/sim_events.cc
+++ b/sim/sim_events.cc
@@ -28,11 +28,13 @@
#include <string>
-#include "sim/param.hh"
-#include "sim/eventq.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/sim_init.hh"
#include "sim/sim_stats.hh"
using namespace std;
@@ -178,7 +180,7 @@ class ProgressEvent : public Event
ProgressEvent::ProgressEvent(EventQueue *q, Tick _interval)
: Event(q), interval(_interval)
{
- schedule(interval);
+ schedule(curTick + interval);
}
//
@@ -221,10 +223,24 @@ ProgressParamContext progessMessageParams("progress");
Param<Tick> progress_interval(&progessMessageParams, "cycle",
"cycle interval for progress messages");
+namespace {
+ struct SetupProgress : public Callback
+ {
+ Tick interval;
+ SetupProgress(Tick tick) : interval(tick) {}
+
+ virtual void process()
+ {
+ new ProgressEvent(&mainEventQueue, interval);
+ delete this;
+ }
+ };
+}
+
/* check execute options */
void
ProgressParamContext::checkParams()
{
if (progress_interval.isValid())
- new ProgressEvent(&mainEventQueue, progress_interval);
+ registerInitCallback(new SetupProgress(progress_interval));
}