#include <opt.h>
Public Member Functions | |
opt () | |
Basic Constructor. | |
void | initSync () |
Initialize the synchronization strategy type of the poser. | |
virtual void | Step () |
Perform a single forward execution step. | |
POSE_TimeType | SafeTime () |
Compute safe time for object. | |
void | AddSpawnedEvent (int AnObjIdx, eventID evID, POSE_TimeType ts) |
Add spawned event to current event's spawned event list. | |
void | CancelSpawn (Event *e) |
Send cancellation messages to all of event e's spawned events. | |
Data Fields | |
int | cpRate |
Checkpoint rate. | |
unsigned int | specEventCount |
unsigned int | eventCount |
unsigned int | stepCount |
unsigned int | avgEventsPerStep |
unsigned int | rbCount |
unsigned int | jumpCount |
POSE_TimeType | avgRBoffset |
POSE_TimeType | avgTimeLeash |
POSE_TimeType | avgJump |
unsigned short int | rbFlag |
Protected Member Functions | |
virtual void | Rollback () |
Rollback to predetermined RBevent. | |
virtual void | RecoverState (Event *recoveryPoint) |
Recover checkpointed state prior to ev. | |
virtual void | CancelEvents () |
Cancel events in cancellation list that have arrived. | |
virtual void | CancelUnexecutedEvents () |
virtual void | UndoEvent (Event *e) |
Undo a single event, cancelling its spawned events. | |
Protected Attributes | |
int | idle |
Idle measure. |
Definition at line 6 of file opt.h.
opt::opt | ( | ) | [inline] |
Basic Constructor.
Definition at line 40 of file opt.h.
References avgRBoffset, cpRate, pose_config, POSE_TimeMax, POSE_Config::store_rate, and strat::STRAT_T.
void opt::Rollback | ( | ) | [protected, virtual] |
Rollback to predetermined RBevent.
Undo a single event, cancelling its spawned events
Cancel events in cancellation list that have arrived
Cancel events in cancellation list that have arrived
Recover checkpointed state prior to ev
Reimplemented from strat.
Definition at line 41 of file opt.C.
References avgRBoffset, eventQueue::back(), sim::basicStats, CancelEvents(), sim::cancels, CancelSpawn(), CancelUnexecutedEvents(), CmiWallTimer(), Event::commitBfr, Event::commitBfrLen, Event::commitErr, Event::cpData, strat::currentEvent, eventQueue::currentPtr, PVT::decEventCount(), eventQueue::DeleteEvent(), EqHeap::DeleteEvent(), Event::done, strat::eq, eventQueue::eqh, eventCount, eventQueue::eventCount, CancelNode::evID, Event::evID, eventQueue::FindLargest(), Event::fnIdx, free(), eventQueue::front(), PVT::getGVT(), CancelList::GetItem(), CancelList::IsEmpty(), strat::localPVT, strat::localStats, rep::localTimePool, eventQueue::mem_usage, Event::msg, Event::next, strat::parent, pose_config, POSE_UnsetTS, Event::prev, rbCount, eventQueue::RBevent, rbFlag, RecoverState(), CancelList::RemoveItem(), sim::ResolveFn(), localStat::Rollback(), Event::serialCPdata, Event::serialCPdataSz, eventQueue::SetCurrentPtr(), eventQueue::ShiftEvent(), POSE_Config::stats, localStat::SwitchTimer(), strat::targetEvent, CancelNode::timestamp, Event::timestamp, TimePool::tmp_free(), POSE_Config::trace, traceUserBracketEvent(), localStat::Undo(), UndoEvent(), sim::UNDOs, strat::userObj, and rep::usesAntimethods().
Referenced by spec::Step(), opt3::Step(), opt2::Step(), Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
virtual void opt::RecoverState | ( | Event * | recoveryPoint | ) | [protected, virtual] |
Recover checkpointed state prior to ev.
Searches backward from recoveryPoint without undoing events or cancelling their spawn, until a checkpoint is found. Then restores the state from this found checkpoint, and uses pseudo-re-execution to return back to recoveryPoint. This means that events are re-executed to reconstruct the state, but any events they would have spawned are not respawned, since they were never cancelled.
Referenced by Rollback().
virtual void opt::CancelEvents | ( | ) | [protected, virtual] |
Cancel events in cancellation list that have arrived.
This will go through all the cancellations and remove whatever has arrived already. For events that have already been executed, a rollback is performed. No forward execution happens until all the cancellations have been examined.
Reimplemented from strat.
Referenced by Rollback(), spec::Step(), opt3::Step(), opt2::Step(), Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
virtual void opt::CancelUnexecutedEvents | ( | ) | [protected, virtual] |
Referenced by Rollback(), spec::Step(), opt3::Step(), opt2::Step(), Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
virtual void opt::UndoEvent | ( | Event * | e | ) | [protected, virtual] |
Undo a single event, cancelling its spawned events.
Referenced by Rollback().
void opt::initSync | ( | ) | [inline, virtual] |
Initialize the synchronization strategy type of the poser.
Reimplemented from strat.
Definition at line 49 of file opt.h.
References strat::parent, and sim::sync.
void opt::Step | ( | ) | [virtual] |
Perform a single forward execution step.
Basic Optimistic Synchronization Strategy.
Prior to the forward execution, cancellation and rollback are done if necessary. Derived strategies typically just reimplement this method
Perform a single forward execution step
Reimplemented from strat.
Reimplemented in adapt, adapt2, adapt3, adapt4, adapt5, opt2, opt3, and spec.
Definition at line 5 of file opt.C.
References CancelEvents(), sim::cancels, CancelUnexecutedEvents(), strat::currentEvent, eventQueue::currentPtr, Event::done, strat::eq, eventCount, Event::fnIdx, PVT::getGVT(), idle, CancelList::IsEmpty(), strat::localPVT, strat::localStats, localStat::Loop(), eventQueue::mem_usage, Event::msg, strat::parent, pose_config, POSE_Objects, POSE_TimeMax, POSE_UnsetTS, eventQueue::RBevent, sim::ResolveFn(), Rollback(), prioMsg::setPriority(), eventQueue::ShiftEvent(), specEventCount, POSE_Config::stats, sim::Status(), stepCount, and Event::timestamp.
POSE_TimeType opt::SafeTime | ( | ) | [inline, virtual] |
Compute safe time for object.
Safe time is the earliest timestamp that this object can generate given its current state (assuming no stragglers, cancellations or events are subsequently received
Reimplemented from strat.
Definition at line 58 of file opt.h.
References sim::cancels, eventQueue::currentPtr, strat::eq, CancelList::getEarliest(), PVT::getGVT(), strat::localPVT, rep::OVT(), strat::parent, POSE_UnsetTS, Event::timestamp, and strat::userObj.
void opt::AddSpawnedEvent | ( | int | AnObjIdx, | |
eventID | evID, | |||
POSE_TimeType | ts | |||
) | [inline] |
Add spawned event to current event's spawned event list.
Definition at line 90 of file opt.h.
References eventQueue::AddSpawnToCurrent(), and strat::eq.
void opt::CancelSpawn | ( | Event * | e | ) | [inline] |
Send cancellation messages to all of event e's spawned events.
Definition at line 94 of file opt.h.
References CmiWallTimer(), SpawnedEvent::evID, cancelMsg::evID, strat::localPVT, PUP::m, SpawnedEvent::next, SpawnedEvent::objIdx, PVT::objUpdate(), pose_config, POSE_Objects, POSE_TimeMax, cancelMsg::setPriority(), Event::spawnedList, SpawnedEvent::timestamp, cancelMsg::timestamp, POSE_Config::trace, and traceUserBracketEvent().
Referenced by Rollback().
unsigned int opt::specEventCount |
Definition at line 35 of file opt.h.
Referenced by Step(), adapt5::Step(), adapt4::Step(), and adapt3::Step().
unsigned int opt::eventCount |
Definition at line 35 of file opt.h.
Referenced by Rollback(), Step(), adapt5::Step(), adapt4::Step(), and adapt3::Step().
unsigned int opt::stepCount |
unsigned int opt::avgEventsPerStep |
unsigned int opt::rbCount |
unsigned int opt::jumpCount |
Definition at line 37 of file opt.h.
Referenced by opt(), Rollback(), adapt5::Step(), adapt4::Step(), and adapt3::Step().
unsigned short int opt::rbFlag |
Definition at line 38 of file opt.h.
Referenced by Rollback(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().