From 31f82cef41962fb57d343f4a8cd468c87d8204dc Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 29 Feb 2004 18:49:44 -0500 Subject: [PATCH] Make the progress event work even after restoring from a checkpoint --HG-- extra : convert_revision : 80e31eb26250700ebe3ce5848e570068cc76ef47 --- sim/sim_events.cc | 24 ++++++++++++++++++++---- 1 file 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 -#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 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)); } -- 2.30.2