Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff 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 |
line diff
1.1 --- a/MasterLoop.c Fri Feb 10 18:35:00 2012 +0100 1.2 +++ b/MasterLoop.c Thu Mar 08 19:02:16 2012 +0100 1.3 @@ -89,6 +89,7 @@ 1.4 1.5 volatileMasterPr = animatingPr; 1.6 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp 1.7 + int vpid,task; 1.8 1.9 //First animation of each MasterVP will in turn animate this part 1.10 // of setup code.. (VP creator sets up the stack as if this function 1.11 @@ -152,8 +153,18 @@ 1.12 saveLowTimeStampCountInto( startStamp1 ); 1.13 #endif 1.14 #ifdef MEAS__PERF_COUNTERS 1.15 - int vpid = currSlot->procrAssignedToSlot->procrID; 1.16 - int task = currSlot->procrAssignedToSlot->numTimesScheduled; 1.17 + /* Request Handler may call resume() on the VP, but we want to 1.18 + * account the whole interval to the same task. Therefore, need 1.19 + * to save task ID at the beginning. 1.20 + * 1.21 + * Using this value as "end of AppResponder Invocation Time" 1.22 + * is possible if there is only one SchedSlot per core - 1.23 + * invoking processor is last to be treated here! If more than 1.24 + * one slot, MasterLoop processing time for all but the last VP 1.25 + * would be erroneously counted as invocation time. 1.26 + */ 1.27 + vpid = currSlot->procrAssignedToSlot->procrID; 1.28 + task = currSlot->procrAssignedToSlot->numTimesScheduled; 1.29 uint64 cycles, instrs; 1.30 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); 1.31 (*counterHandler)(AppResponder_start,vpid,task,currSlot->procrAssignedToSlot,cycles,instrs); 1.32 @@ -169,10 +180,11 @@ 1.33 _VMSMasterEnv->reqHdlrHighTimeHist ); 1.34 #endif 1.35 #ifdef MEAS__PERF_COUNTERS 1.36 - //done with constraints check 1.37 + //use previous task ID here (may or may not be the same as current VP state) 1.38 uint64 cycles2,instrs2; 1.39 saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2); 1.40 (*counterHandler)(AppResponder_end,vpid,task,currSlot->procrAssignedToSlot,cycles2,instrs2); 1.41 + (*counterHandler)(Timestamp_end,vpid,task,currSlot->procrAssignedToSlot,rdtsc(),0); 1.42 #endif 1.43 //============================================================ 1.44 } 1.45 @@ -180,11 +192,22 @@ 1.46 { //give slot a new virt procr 1.47 #ifdef MEAS__PERF_COUNTERS 1.48 //start assigner 1.49 + /* Don't know who to account time to yet - goes to assigned VP 1.50 + * after the call. 1.51 + */ 1.52 + int empty = FALSE; 1.53 + if(currSlot->procrAssignedToSlot == NULL){ 1.54 + empty= TRUE; 1.55 + } 1.56 uint64 tmp_cycles; 1.57 uint64 tmp_instrs; 1.58 saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs); 1.59 - //FIXME WTF AM I DOING WHY DOES THIS EVEN WORK 1.60 - //(*counterHandler)(MasterLoop_beforeNextAssign,schedVirtPr,tmp_cycles,tmp_instrs); 1.61 + uint64 tsc = rdtsc(); 1.62 + if(vpid > 0) { 1.63 + (*counterHandler)(NextAssigner_start,vpid,task,currSlot->procrAssignedToSlot,tmp_cycles,tmp_instrs); 1.64 + vpid = 0; 1.65 + task = 0; 1.66 + } 1.67 #endif 1.68 schedVirtPr = 1.69 (*slaveScheduler)( semanticEnv, thisCoresIdx, slotIdx ); 1.70 @@ -201,6 +224,11 @@ 1.71 uint64 cycles; 1.72 uint64 instrs; 1.73 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs); 1.74 + 1.75 + if(empty){ 1.76 + (*counterHandler)(AssignerInvocation_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,masterEnv->start_master_lock[thisCoresIdx][0],masterEnv->start_master_lock[thisCoresIdx][1]); 1.77 + } 1.78 + (*counterHandler)(Timestamp_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,tsc,0); 1.79 (*counterHandler)(Assigner_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,tmp_cycles,tmp_instrs); 1.80 (*counterHandler)(Assigner_end,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,cycles,instrs); 1.81 #endif
