diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2012-01-05 11:02:56 -0600 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2012-01-05 11:02:56 -0600 |
commit | daa4c7526acf97bf53b1cdfc6a4d6a327f1966dd (patch) | |
tree | 30c1b54ea6e0acb2f8c2fc2c2c65c3a07935a1e3 | |
parent | d3aa01eed9972bf1e20e3a6888b27f648a4730da (diff) | |
download | gem5-daa4c7526acf97bf53b1cdfc6a4d6a327f1966dd.tar.xz |
eventq: add a function for replacing head of the queue
This patch adds a function for replacing the event at the head of the queue
with another event. This helps in running a different set of events. Events
already scheduled can processed by replacing the original head event back.
This function has been specifically added to support cache warmup and
cooldown required for creating and restoring checkpoints.
--HG--
extra : rebase_source : ed6e2905720b6bfdefd020fab76235ccf33d28d1
-rw-r--r-- | src/sim/eventq.cc | 8 | ||||
-rw-r--r-- | src/sim/eventq.hh | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/sim/eventq.cc b/src/sim/eventq.cc index 78524fe51..b389efcf2 100644 --- a/src/sim/eventq.cc +++ b/src/sim/eventq.cc @@ -373,6 +373,14 @@ EventQueue::debugVerify() const return true; } +Event* +EventQueue::replaceHead(Event* s) +{ + Event* t = head; + head = s; + return t; +} + void dumpMainQueue() { diff --git a/src/sim/eventq.hh b/src/sim/eventq.hh index 1509d05a5..6dc25e760 100644 --- a/src/sim/eventq.hh +++ b/src/sim/eventq.hh @@ -408,6 +408,16 @@ class EventQueue : public Serializable bool debugVerify() const; + /** + * function for replacing the head of the event queue, so that a + * different set of events can run without disturbing events that have + * already been scheduled. Already scheduled events can be processed + * by replacing the original head back. + * USING THIS FUNCTION CAN BE DANGEROUS TO THE HEALTH OF THE SIMULATOR. + * NOT RECOMMENDED FOR USE. + */ + Event* replaceHead(Event* s); + #ifndef SWIG virtual void serialize(std::ostream &os); virtual void unserialize(Checkpoint *cp, const std::string §ion); |