00001 00002 #include "pose.h" 00003 00004 void opt2::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 if ((ev->timestamp > POSE_UnsetTS) && 00018 ((POSE_endtime == POSE_UnsetTS) || (ev->timestamp <= POSE_endtime))){ 00019 POSE_TimeType fix_time = ev->timestamp; 00020 while (ev->timestamp == fix_time) { 00021 // do all events at the first available timestamp 00022 iter++; 00023 currentEvent = ev; 00024 ev->done = 2; 00025 parent->ResolveFn(ev->fnIdx, ev->msg); // execute it 00026 ev->done = 1; // complete the event execution 00027 eq->mem_usage++; 00028 eq->ShiftEvent(); // shift to next event 00029 ev = eq->currentPtr; // reset ev 00030 } 00031 #if !CMK_TRACE_DISABLED 00032 if(pose_config.stats) 00033 if (iter > 0) localStats->Loop(); 00034 #endif 00035 if (eq->currentPtr->timestamp >= 0) { // if more events, schedule the next 00036 prioMsg *pm = new prioMsg; 00037 pm->setPriority(eq->currentPtr->timestamp-POSE_TimeMax); 00038 POSE_Objects[parent->thisIndex].Step(pm); 00039 } 00040 } 00041 } 00042