Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison MasterLoop.c @ 211:5b419522dc7f
time stamp checks added
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Thu, 08 Mar 2012 19:02:16 +0100 |
| parents | 20358f56e498 |
| children |
comparison
equal
deleted
inserted
replaced
| 55:6f7dea0292dc | 61:0ef7eb675676 |
|---|---|
| 87 VirtProcr *masterPr; | 87 VirtProcr *masterPr; |
| 88 volatile VirtProcr *volatileMasterPr; | 88 volatile VirtProcr *volatileMasterPr; |
| 89 | 89 |
| 90 volatileMasterPr = animatingPr; | 90 volatileMasterPr = animatingPr; |
| 91 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp | 91 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp |
| 92 int vpid,task; | |
| 92 | 93 |
| 93 //First animation of each MasterVP will in turn animate this part | 94 //First animation of each MasterVP will in turn animate this part |
| 94 // of setup code.. (VP creator sets up the stack as if this function | 95 // of setup code.. (VP creator sets up the stack as if this function |
| 95 // was called normally, but actually get here by jmp) | 96 // was called normally, but actually get here by jmp) |
| 96 //So, setup values about stack ptr, jmp pt and all that | 97 //So, setup values about stack ptr, jmp pt and all that |
| 150 #ifdef MEAS__TIME_PLUGIN | 151 #ifdef MEAS__TIME_PLUGIN |
| 151 int32 startStamp1, endStamp1; | 152 int32 startStamp1, endStamp1; |
| 152 saveLowTimeStampCountInto( startStamp1 ); | 153 saveLowTimeStampCountInto( startStamp1 ); |
| 153 #endif | 154 #endif |
| 154 #ifdef MEAS__PERF_COUNTERS | 155 #ifdef MEAS__PERF_COUNTERS |
| 155 int vpid = currSlot->procrAssignedToSlot->procrID; | 156 /* Request Handler may call resume() on the VP, but we want to |
| 156 int task = currSlot->procrAssignedToSlot->numTimesScheduled; | 157 * account the whole interval to the same task. Therefore, need |
| 158 * to save task ID at the beginning. | |
| 159 * | |
| 160 * Using this value as "end of AppResponder Invocation Time" | |
| 161 * is possible if there is only one SchedSlot per core - | |
| 162 * invoking processor is last to be treated here! If more than | |
| 163 * one slot, MasterLoop processing time for all but the last VP | |
| 164 * would be erroneously counted as invocation time. | |
| 165 */ | |
| 166 vpid = currSlot->procrAssignedToSlot->procrID; | |
| 167 task = currSlot->procrAssignedToSlot->numTimesScheduled; | |
| 157 uint64 cycles, instrs; | 168 uint64 cycles, instrs; |
| 158 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); | 169 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); |
| 159 (*counterHandler)(AppResponder_start,vpid,task,currSlot->procrAssignedToSlot,cycles,instrs); | 170 (*counterHandler)(AppResponder_start,vpid,task,currSlot->procrAssignedToSlot,cycles,instrs); |
| 160 #endif | 171 #endif |
| 161 //============================================================ | 172 //============================================================ |
| 167 _VMSMasterEnv->reqHdlrLowTimeHist ); | 178 _VMSMasterEnv->reqHdlrLowTimeHist ); |
| 168 addIntervalToHist( startStamp1, endStamp1, | 179 addIntervalToHist( startStamp1, endStamp1, |
| 169 _VMSMasterEnv->reqHdlrHighTimeHist ); | 180 _VMSMasterEnv->reqHdlrHighTimeHist ); |
| 170 #endif | 181 #endif |
| 171 #ifdef MEAS__PERF_COUNTERS | 182 #ifdef MEAS__PERF_COUNTERS |
| 172 //done with constraints check | 183 //use previous task ID here (may or may not be the same as current VP state) |
| 173 uint64 cycles2,instrs2; | 184 uint64 cycles2,instrs2; |
| 174 saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2); | 185 saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2); |
| 175 (*counterHandler)(AppResponder_end,vpid,task,currSlot->procrAssignedToSlot,cycles2,instrs2); | 186 (*counterHandler)(AppResponder_end,vpid,task,currSlot->procrAssignedToSlot,cycles2,instrs2); |
| 187 (*counterHandler)(Timestamp_end,vpid,task,currSlot->procrAssignedToSlot,rdtsc(),0); | |
| 176 #endif | 188 #endif |
| 177 //============================================================ | 189 //============================================================ |
| 178 } | 190 } |
| 179 if( currSlot->needsProcrAssigned ) | 191 if( currSlot->needsProcrAssigned ) |
| 180 { //give slot a new virt procr | 192 { //give slot a new virt procr |
| 181 #ifdef MEAS__PERF_COUNTERS | 193 #ifdef MEAS__PERF_COUNTERS |
| 182 //start assigner | 194 //start assigner |
| 195 /* Don't know who to account time to yet - goes to assigned VP | |
| 196 * after the call. | |
| 197 */ | |
| 198 int empty = FALSE; | |
| 199 if(currSlot->procrAssignedToSlot == NULL){ | |
| 200 empty= TRUE; | |
| 201 } | |
| 183 uint64 tmp_cycles; | 202 uint64 tmp_cycles; |
| 184 uint64 tmp_instrs; | 203 uint64 tmp_instrs; |
| 185 saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs); | 204 saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs); |
| 186 //FIXME WTF AM I DOING WHY DOES THIS EVEN WORK | 205 uint64 tsc = rdtsc(); |
| 187 //(*counterHandler)(MasterLoop_beforeNextAssign,schedVirtPr,tmp_cycles,tmp_instrs); | 206 if(vpid > 0) { |
| 207 (*counterHandler)(NextAssigner_start,vpid,task,currSlot->procrAssignedToSlot,tmp_cycles,tmp_instrs); | |
| 208 vpid = 0; | |
| 209 task = 0; | |
| 210 } | |
| 188 #endif | 211 #endif |
| 189 schedVirtPr = | 212 schedVirtPr = |
| 190 (*slaveScheduler)( semanticEnv, thisCoresIdx, slotIdx ); | 213 (*slaveScheduler)( semanticEnv, thisCoresIdx, slotIdx ); |
| 191 | 214 |
| 192 if( schedVirtPr != NULL ) | 215 if( schedVirtPr != NULL ) |
| 199 | 222 |
| 200 #ifdef MEAS__PERF_COUNTERS | 223 #ifdef MEAS__PERF_COUNTERS |
| 201 uint64 cycles; | 224 uint64 cycles; |
| 202 uint64 instrs; | 225 uint64 instrs; |
| 203 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs); | 226 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs); |
| 227 | |
| 228 if(empty){ | |
| 229 (*counterHandler)(AssignerInvocation_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,masterEnv->start_master_lock[thisCoresIdx][0],masterEnv->start_master_lock[thisCoresIdx][1]); | |
| 230 } | |
| 231 (*counterHandler)(Timestamp_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,tsc,0); | |
| 204 (*counterHandler)(Assigner_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,tmp_cycles,tmp_instrs); | 232 (*counterHandler)(Assigner_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,tmp_cycles,tmp_instrs); |
| 205 (*counterHandler)(Assigner_end,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,cycles,instrs); | 233 (*counterHandler)(Assigner_end,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,cycles,instrs); |
| 206 #endif | 234 #endif |
| 207 } | 235 } |
| 208 } | 236 } |
