#include <evq.h>
Public Member Functions | |
eventQueue () | |
Basic Constructor. | |
~eventQueue () | |
Destructor. | |
void | InsertEvent (Event *e) |
Insert e in the queue in timestamp order. | |
void | InsertEventDeterministic (Event *e) |
Insert e in the queue in timestamp order. | |
Event * | front () |
Return front pointer. | |
Event * | back () |
Return back pointer. | |
void | ShiftEvent () |
Move currentPtr to next event in queue. | |
void | CommitEvents (sim *obj, POSE_TimeType ts) |
Commit (delete) events before target timestamp ts. | |
void | CommitAll (sim *obj) |
Commit (delete) all events. | |
void | CommitDoneEvents (sim *obj) |
Commit (delete) all events that are done (used in sequential mode). | |
void | SetCurrentPtr (Event *e) |
Change currentPtr to point to event e. | |
void | DeleteEvent (Event *ev) |
Delete event and reconnect surrounding events in queue. | |
const eventID & | CurrentEventID () |
Return the event ID of the event pointed to by currentPtr. | |
void | AddSpawnToCurrent (int id, eventID e, POSE_TimeType ts) |
Add id, e and ts as an entry in currentPtr's spawned list. | |
SpawnedEvent * | GetNextCurrentSpawn () |
Return the first entry in currentPtr's spawned list and remove it. | |
void | FindLargest () |
Find the largest timestamp of the unexecuted events. | |
void | SetRBevent (Event *e) |
Set rollback point to event e. | |
void | dump () |
Dump the event queue. | |
char * | dumpString () |
Dump the event queue to a string. | |
void | pup (PUP::er &p) |
Pack/unpack/sizing operator. | |
void | sanitize () |
Check validity of data fields. | |
Data Fields | |
Event * | frontPtr |
Sentinel nodes. | |
Event * | backPtr |
Event * | currentPtr |
Pointer to next unexecuted event. | |
Event * | RBevent |
Event to rollback to. | |
EqHeap * | eqh |
Heap of unexecuted events. | |
POSE_TimeType | largest |
Largest unexecuted event timestamp in queue. | |
unsigned int | eventCount |
number of unexecuted events in the queue | |
POSE_TimeType | tsOfLastInserted |
Timestamp of the last event inserted in the queue. | |
unsigned int | mem_usage |
Coarse memory usage. | |
POSE_TimeType | lastLoggedVT |
Keep track of last logged VT for this object so no duplicates are logged. | |
int | recentAvgEventSparsity |
Average sparsity of recently committed events (in GVT ticks / event). | |
POSE_TimeType | sparsityStartTime |
Timestamp of the first event for the sparsity calculation. | |
int | sparsityCalcCount |
Sparsity calculation counter. | |
int | tsDiffCount |
Counts the differences examined; used for timeleash calculation in adapt5. | |
POSE_TimeType | lastCommittedTS |
The timestamp of the last committed event. | |
POSE_TimeType | tsCommitDiffs [DIFFS_TO_STORE] |
The largest timestamp differences at commit time; used for timeleash calculation in adapt5. | |
TimePool * | localTimePool |
Private Member Functions | |
void | CommitStatsHelper (sim *obj, Event *commitPtr) |
This helper method cleans up all the commit code by removing the stats. |
Doubly-linked list with front and back sentinels and a heap of unexecuted events
Definition at line 10 of file evq.h.
eventQueue::eventQueue | ( | ) |
Basic Constructor.
Queue of executed and unexecuted events on a poser.
Creates front and back sentinel nodes, connects them, and inits pointers and heap.
Basic Constructor
Definition at line 5 of file evq.C.
References backPtr, CkLocalBranch(), Event::commitBfr, Event::commitBfrLen, currentPtr, Event::done, eqh, eventCount, Event::fnIdx, frontPtr, largest, lastCommittedTS, lastLoggedVT, localTimePool, mem_usage, Event::msg, Event::next, POSE_UnsetTS, Event::prev, RBevent, recentAvgEventSparsity, sanitize(), sparsityCalcCount, sparsityStartTime, Event::spawnedList, TempMemID, Event::timestamp, tsCommitDiffs, tsDiffCount, and tsOfLastInserted.
eventQueue::~eventQueue | ( | ) |
This helper method cleans up all the commit code by removing the stats.
Definition at line 157 of file evq.C.
References CkLocalBranch(), localStat::Commit(), POSE_Config::dop, Event::ert, Event::evt, int, lastCommittedTS, lastLoggedVT, sim::myStrat, pose_config, recentAvgEventSparsity, localStat::SetMaximums(), sparsityCalcCount, sparsityStartTime, Event::srt, POSE_Config::stats, strat::STRAT_T, Event::svt, theLocalStats, Event::timestamp, tsCommitDiffs, tsDiffCount, and localStat::WriteDopData().
Referenced by CommitEvents().
void eventQueue::InsertEvent | ( | Event * | e | ) |
Insert e in the queue in timestamp order.
If executed events with same timestamp exist, insert e at the back of these, returns 0 if rollback necessary, 1 otherwise.
Definition at line 71 of file evq.C.
References backPtr, currentPtr, POSE_Config::deterministic, Event::done, eqh, eventCount, Event::evID, EqHeap::InsertEvent(), InsertEventDeterministic(), largest, Event::next, pose_config, Event::prev, sanitize(), SetRBevent(), Event::timestamp, and tsOfLastInserted.
void eventQueue::InsertEventDeterministic | ( | Event * | e | ) |
Insert e in the queue in timestamp order.
If executed events with same timestamp exist, sort e into them based on eventID, returns 0 if rollback necessary, 1 otherwise.
If executed events with same timestamp exist, sort e into them based on eventID
Definition at line 118 of file evq.C.
References backPtr, currentPtr, Event::done, eqh, eventCount, Event::evID, EqHeap::InsertEvent(), largest, Event::next, Event::prev, sanitize(), SetRBevent(), and Event::timestamp.
Referenced by InsertEvent().
Event* eventQueue::front | ( | ) | [inline] |
Return front pointer.
Definition at line 62 of file evq.h.
Referenced by chpt< StateType >::checkpoint(), and opt::Rollback().
Event* eventQueue::back | ( | ) | [inline] |
Return back pointer.
Definition at line 64 of file evq.h.
Referenced by con::CancelEvents(), and opt::Rollback().
void eventQueue::ShiftEvent | ( | ) | [inline] |
Move currentPtr to next event in queue.
If no more events, take one from heap
Definition at line 67 of file evq.h.
Referenced by con::CancelEvents(), opt::Rollback(), strat::Step(), spec::Step(), seq::Step(), opt3::Step(), opt2::Step(), opt::Step(), con::Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
void eventQueue::CommitEvents | ( | sim * | obj, | |
POSE_TimeType | ts | |||
) |
Commit (delete) events before target timestamp ts.
Commit (delete) all events
Commit (delete) all events that are done (used in sequential mode)
Change currentPtr to point to event e
Delete event and reconnect surrounding events in queue
Dump the event queue
Dump the event queue to a string
Pack/unpack/sizing operator
Check validity of data fields
Definition at line 230 of file evq.C.
References backPtr, sim::basicStats, CmiAbort(), CommitAll(), Event::commitBfr, Event::commitBfrLen, CommitDoneEvents(), Event::commitErr, CommitStatsHelper(), Event::cpData, currentPtr, DeleteEvent(), Event::done, EqHeap::dump(), eventID::dump(), dump(), EqHeap::dumpString(), dumpString(), TimePool::empty_recycle_bin(), eqh, eventCount, Event::evID, FindLargest(), Event::fnIdx, frontPtr, EqHeap::GetAndRemoveTopEvent(), eventID::getPE(), eventID::id, PUP::er::isUnpacking(), largest, localTimePool, mem_usage, Event::msg, Event::next, sim::objID, p, POSE_endtime, POSE_UnsetTS, Event::prev, EqHeap::pup(), Event::pup(), pup(), RBevent, recentAvgEventSparsity, sim::ResolveCommitFn(), EqHeap::sanitize(), Event::sanitize(), sanitize(), Event::serialCPdata, TimePool::set_min_time(), SetCurrentPtr(), snprintf(), sparsityCalcCount, sparsityStartTime, Event::spawnedList, Event::timestamp, TimePool::tmp_free(), EqHeap::top, tsOfLastInserted, and rep::usesAntimethods().
Referenced by sim::CheckpointCommit(), and sim::Commit().
void eventQueue::CommitAll | ( | sim * | obj | ) |
Commit (delete) all events.
Referenced by CommitEvents().
void eventQueue::CommitDoneEvents | ( | sim * | obj | ) |
Commit (delete) all events that are done (used in sequential mode).
Referenced by CommitEvents(), and seq::Step().
void eventQueue::SetCurrentPtr | ( | Event * | e | ) |
Change currentPtr to point to event e.
Be very very careful with this -- avoid using if possible
Referenced by CommitEvents(), and opt::Rollback().
void eventQueue::DeleteEvent | ( | Event * | ev | ) |
Delete event and reconnect surrounding events in queue.
Referenced by con::CancelEvents(), CommitEvents(), and opt::Rollback().
const eventID& eventQueue::CurrentEventID | ( | ) | [inline] |
void eventQueue::AddSpawnToCurrent | ( | int | id, | |
eventID | e, | |||
POSE_TimeType | ts | |||
) | [inline] |
Add id, e and ts as an entry in currentPtr's spawned list.
The poser e was sent to is id
Definition at line 105 of file evq.h.
Referenced by opt::AddSpawnedEvent().
SpawnedEvent* eventQueue::GetNextCurrentSpawn | ( | ) | [inline] |
Return the first entry in currentPtr's spawned list and remove it.
Definition at line 112 of file evq.h.
References SpawnedEvent::next.
void eventQueue::FindLargest | ( | ) | [inline] |
Find the largest timestamp of the unexecuted events.
Definition at line 118 of file evq.h.
References POSE_UnsetTS.
Referenced by CommitEvents(), and opt::Rollback().
void eventQueue::SetRBevent | ( | Event * | e | ) | [inline] |
Set rollback point to event e.
Definition at line 125 of file evq.h.
References POSE_Config::deterministic, Event::evID, pose_config, and Event::timestamp.
Referenced by InsertEvent(), and InsertEventDeterministic().
void eventQueue::dump | ( | ) |
Dump the event queue.
Referenced by CommitEvents(), and sim::dump().
char* eventQueue::dumpString | ( | ) |
Dump the event queue to a string.
Referenced by CommitEvents().
void eventQueue::pup | ( | PUP::er & | p | ) |
Pack/unpack/sizing operator.
Referenced by CommitEvents(), and sim::pup().
void eventQueue::sanitize | ( | ) |
Check validity of data fields.
Referenced by CommitEvents(), eventQueue(), InsertEvent(), and InsertEventDeterministic().
Sentinel nodes.
Definition at line 15 of file evq.h.
Referenced by CommitEvents(), eventQueue(), and ~eventQueue().
Definition at line 15 of file evq.h.
Referenced by CommitEvents(), eventQueue(), InsertEvent(), and InsertEventDeterministic().
Pointer to next unexecuted event.
Definition at line 17 of file evq.h.
Referenced by con::CancelEvents(), sim::Commit(), CommitEvents(), eventQueue(), InsertEvent(), InsertEventDeterministic(), sim::ReportLBdata(), opt::Rollback(), opt::SafeTime(), con::SafeTime(), sim::SeqResumeAfterCheckpoint(), strat::Step(), spec::Step(), seq::Step(), opt3::Step(), opt2::Step(), opt::Step(), con::Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), adapt::Step(), and rep::update().
Event to rollback to.
Definition at line 19 of file evq.h.
Referenced by CommitEvents(), eventQueue(), opt::Rollback(), spec::Step(), opt3::Step(), opt2::Step(), opt::Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
Heap of unexecuted events.
Definition at line 21 of file evq.h.
Referenced by con::CancelEvents(), CommitEvents(), eventQueue(), InsertEvent(), InsertEventDeterministic(), opt::Rollback(), and ~eventQueue().
Largest unexecuted event timestamp in queue.
Definition at line 23 of file evq.h.
Referenced by CommitEvents(), eventQueue(), InsertEvent(), and InsertEventDeterministic().
unsigned int eventQueue::eventCount |
number of unexecuted events in the queue
Definition at line 25 of file evq.h.
Referenced by CommitEvents(), eventQueue(), InsertEvent(), InsertEventDeterministic(), and opt::Rollback().
Timestamp of the last event inserted in the queue.
Definition at line 27 of file evq.h.
Referenced by CommitEvents(), eventQueue(), InsertEvent(), and seq::Step().
unsigned int eventQueue::mem_usage |
Coarse memory usage.
Definition at line 29 of file evq.h.
Referenced by CommitEvents(), eventQueue(), opt::Rollback(), spec::Step(), opt3::Step(), opt2::Step(), opt::Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
Keep track of last logged VT for this object so no duplicates are logged.
Definition at line 31 of file evq.h.
Referenced by CommitStatsHelper(), and eventQueue().
Average sparsity of recently committed events (in GVT ticks / event).
Definition at line 33 of file evq.h.
Referenced by CommitEvents(), CommitStatsHelper(), and eventQueue().
Timestamp of the first event for the sparsity calculation.
Definition at line 35 of file evq.h.
Referenced by CommitEvents(), CommitStatsHelper(), and eventQueue().
Sparsity calculation counter.
Definition at line 37 of file evq.h.
Referenced by CommitEvents(), CommitStatsHelper(), and eventQueue().
Counts the differences examined; used for timeleash calculation in adapt5.
Definition at line 39 of file evq.h.
Referenced by CommitStatsHelper(), and eventQueue().
The timestamp of the last committed event.
Definition at line 41 of file evq.h.
Referenced by CommitStatsHelper(), and eventQueue().
POSE_TimeType eventQueue::tsCommitDiffs[DIFFS_TO_STORE] |
The largest timestamp differences at commit time; used for timeleash calculation in adapt5.
Definition at line 43 of file evq.h.
Referenced by CommitStatsHelper(), and eventQueue().