00001 00002 #include "pose.h" 00003 00004 void opt3::Step() 00005 { 00006 Event *ev; 00007 POSE_TimeType lastGVT = localPVT->getGVT(); 00008 int iter = 0; 00009 00010 if (!parent->cancels.IsEmpty()) CancelUnexecutedEvents(); 00011 if (eq->RBevent) Rollback(); 00012 if (!parent->cancels.IsEmpty()) CancelEvents(); 00013 parent->Status(); 00014 00015 // Prepare to execute an event 00016 ev = eq->currentPtr; 00017 // Shorten the leash as we near POSE_endtime 00018 if ((POSE_endtime > POSE_UnsetTS) && (lastGVT + timeLeash > POSE_endtime)) 00019 timeLeash = POSE_endtime - lastGVT + 1; 00020 00021 if ((ev->timestamp > POSE_UnsetTS) && (ev->timestamp <= lastGVT + timeLeash)) { 00022 POSE_TimeType fix_time = ev->timestamp; 00023 while (ev->timestamp == fix_time) { 00024 // do all events at the first available timestamp 00025 iter++; 00026 currentEvent = ev; 00027 ev->done = 2; 00028 parent->ResolveFn(ev->fnIdx, ev->msg); // execute it 00029 ev->done = 1; // complete the event execution 00030 eq->mem_usage++; 00031 eq->ShiftEvent(); // shift to next event 00032 ev = eq->currentPtr; // reset ev 00033 } 00034 #if !CMK_TRACE_DISABLED 00035 if(pose_config.stats) 00036 if (iter > 0) localStats->Loop(); 00037 #endif 00038 if (eq->currentPtr->timestamp > POSE_UnsetTS) { 00039 // execute next event if there is one 00040 prioMsg *pm = new prioMsg; 00041 pm->setPriority(eq->currentPtr->timestamp-POSE_TimeMax); 00042 POSE_Objects[parent->thisIndex].Step(pm); 00043 } 00044 } 00045 } 00046