diff options
author | Curtis Dunham <Curtis.Dunham@arm.com> | 2015-03-26 11:16:44 -0400 |
---|---|---|
committer | Curtis Dunham <Curtis.Dunham@arm.com> | 2015-03-26 11:16:44 -0400 |
commit | a1164154ded6c1fa3c6a94f38abfcf96aefc20aa (patch) | |
tree | 0b38790cebe53104b0b4f14f2cb9bce4e557d18e | |
parent | a196dbe3bffb9cde0128902f07bbdab2d6269577 (diff) | |
download | gem5-a1164154ded6c1fa3c6a94f38abfcf96aefc20aa.tar.xz |
sim: Update limit_event reuse to final version
Matching final version on reviewboard.
-rw-r--r-- | src/sim/sim_events.hh | 5 | ||||
-rw-r--r-- | src/sim/simulate.cc | 13 | ||||
-rw-r--r-- | src/sim/simulate.hh | 2 |
3 files changed, 6 insertions, 14 deletions
diff --git a/src/sim/sim_events.hh b/src/sim/sim_events.hh index 4d001f8f0..5be2609fd 100644 --- a/src/sim/sim_events.hh +++ b/src/sim/sim_events.hh @@ -71,11 +71,6 @@ class GlobalSimLoopExitEvent : public GlobalEvent void process(); // process event virtual const char *description() const; - - virtual ~GlobalSimLoopExitEvent() { - // simulate()'s singleton GlobalSimLoopExitEvent is always scheduled - deschedule(); - } }; class LocalSimLoopExitEvent : public Event diff --git a/src/sim/simulate.cc b/src/sim/simulate.cc index 14dd00fc1..e0b80bbe8 100644 --- a/src/sim/simulate.cc +++ b/src/sim/simulate.cc @@ -71,13 +71,7 @@ thread_loop(EventQueue *queue) } } -GlobalEvent* -getLimitEvent(void) { - static GlobalSimLoopExitEvent - simulate_limit_event(mainEventQueue[0]->getCurTick(), - "simulate() limit reached", 0); - return &simulate_limit_event; -} +GlobalSimLoopExitEvent *simulate_limit_event = nullptr; /** Simulate for num_cycles additional cycles. If num_cycles is -1 * (the default), do not limit simulation; some other event must @@ -104,6 +98,9 @@ simulate(Tick num_cycles) } threads_initialized = true; + simulate_limit_event = + new GlobalSimLoopExitEvent(mainEventQueue[0]->getCurTick(), + "simulate() limit reached", 0); } inform("Entering event queue @ %d. Starting simulation...\n", curTick()); @@ -113,7 +110,7 @@ simulate(Tick num_cycles) else // counter would roll over or be set to MaxTick anyhow num_cycles = MaxTick; - getLimitEvent()->reschedule(num_cycles); + simulate_limit_event->reschedule(num_cycles); GlobalSyncEvent *quantum_event = NULL; if (numMainEventQueues > 1) { diff --git a/src/sim/simulate.hh b/src/sim/simulate.hh index 18be7ea82..85d58e119 100644 --- a/src/sim/simulate.hh +++ b/src/sim/simulate.hh @@ -33,4 +33,4 @@ #include "sim/sim_events.hh" GlobalSimLoopExitEvent *simulate(Tick num_cycles = MaxTick); -GlobalEvent* getLimitEvent(); +extern GlobalSimLoopExitEvent *simulate_limit_event; |