From daa4c7526acf97bf53b1cdfc6a4d6a327f1966dd Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Thu, 5 Jan 2012 11:02:56 -0600 Subject: [PATCH] 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 --- src/sim/eventq.cc | 8 ++++++++ src/sim/eventq.hh | 10 ++++++++++ 2 files changed, 18 insertions(+) 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); -- 2.30.2