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
This commit is contained in:
Nilay Vaish 2012-01-05 11:02:56 -06:00
parent d3aa01eed9
commit daa4c7526a
2 changed files with 18 additions and 0 deletions

View file

@ -373,6 +373,14 @@ EventQueue::debugVerify() const
return true; return true;
} }
Event*
EventQueue::replaceHead(Event* s)
{
Event* t = head;
head = s;
return t;
}
void void
dumpMainQueue() dumpMainQueue()
{ {

View file

@ -408,6 +408,16 @@ class EventQueue : public Serializable
bool debugVerify() const; 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 #ifndef SWIG
virtual void serialize(std::ostream &os); virtual void serialize(std::ostream &os);
virtual void unserialize(Checkpoint *cp, const std::string &section); virtual void unserialize(Checkpoint *cp, const std::string &section);