From: Nathan Binkert Date: Sun, 29 Feb 2004 23:49:44 +0000 (-0500) Subject: Make the progress event work even after restoring from a checkpoint X-Git-Tag: m5_1.0_beta2~114 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31f82cef41962fb57d343f4a8cd468c87d8204dc;p=gem5.git Make the progress event work even after restoring from a checkpoint --HG-- extra : convert_revision : 80e31eb26250700ebe3ce5848e570068cc76ef47 --- 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)); }