comparison MasterLoop.c @ 193:20358f56e498

fix coreloop recording bug and eliminate race condition on measurement-collecting list
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Thu, 09 Feb 2012 15:40:11 +0100
parents fe5ad5726e36
children 5b419522dc7f
comparison
equal deleted inserted replaced
53:97c66f26e96b 55:6f7dea0292dc
131 semanticEnv = masterEnv->semanticEnv; 131 semanticEnv = masterEnv->semanticEnv;
132 132
133 #ifdef MEAS__PERF_COUNTERS 133 #ifdef MEAS__PERF_COUNTERS
134 CounterHandler counterHandler = masterEnv->counterHandler; 134 CounterHandler counterHandler = masterEnv->counterHandler;
135 #endif 135 #endif
136 136 //
137 //Poll each slot's Done flag 137 //Poll each slot's Done flag
138 numSlotsFilled = 0; 138 numSlotsFilled = 0;
139 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) 139 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++)
140 { 140 {
141 currSlot = schedSlots[ slotIdx ]; 141 currSlot = schedSlots[ slotIdx ];
150 #ifdef MEAS__TIME_PLUGIN 150 #ifdef MEAS__TIME_PLUGIN
151 int32 startStamp1, endStamp1; 151 int32 startStamp1, endStamp1;
152 saveLowTimeStampCountInto( startStamp1 ); 152 saveLowTimeStampCountInto( startStamp1 );
153 #endif 153 #endif
154 #ifdef MEAS__PERF_COUNTERS 154 #ifdef MEAS__PERF_COUNTERS
155 VirtProcr p_sav = *(currSlot->procrAssignedToSlot); 155 int vpid = currSlot->procrAssignedToSlot->procrID;
156 int task = currSlot->procrAssignedToSlot->numTimesScheduled;
156 uint64 cycles, instrs; 157 uint64 cycles, instrs;
157 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); 158 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs);
158 (*counterHandler)(MasterLoop_beforeReqHdlr,&p_sav,cycles,instrs); 159 (*counterHandler)(AppResponder_start,vpid,task,currSlot->procrAssignedToSlot,cycles,instrs);
159 #endif 160 #endif
160 //============================================================ 161 //============================================================
161 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); 162 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv );
162 //====================== MEASUREMENT STUFF =================== 163 //====================== MEASUREMENT STUFF ===================
163 #ifdef MEAS__TIME_PLUGIN 164 #ifdef MEAS__TIME_PLUGIN
169 #endif 170 #endif
170 #ifdef MEAS__PERF_COUNTERS 171 #ifdef MEAS__PERF_COUNTERS
171 //done with constraints check 172 //done with constraints check
172 uint64 cycles2,instrs2; 173 uint64 cycles2,instrs2;
173 saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2); 174 saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2);
174 (*counterHandler)(MasterLoop_afterReqHdlr,&p_sav,cycles2,instrs2); 175 (*counterHandler)(AppResponder_end,vpid,task,currSlot->procrAssignedToSlot,cycles2,instrs2);
175 #endif 176 #endif
176 //============================================================ 177 //============================================================
177 } 178 }
178 if( currSlot->needsProcrAssigned ) 179 if( currSlot->needsProcrAssigned )
179 { //give slot a new virt procr 180 { //give slot a new virt procr
198 199
199 #ifdef MEAS__PERF_COUNTERS 200 #ifdef MEAS__PERF_COUNTERS
200 uint64 cycles; 201 uint64 cycles;
201 uint64 instrs; 202 uint64 instrs;
202 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs); 203 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs);
203 (*counterHandler)(MasterLoop_beforeAssign,schedVirtPr,tmp_cycles,tmp_instrs); 204 (*counterHandler)(Assigner_start,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,tmp_cycles,tmp_instrs);
204 (*counterHandler)(MasterLoop_afterAssign,schedVirtPr,cycles,instrs); 205 (*counterHandler)(Assigner_end,schedVirtPr->procrID,schedVirtPr->numTimesScheduled,schedVirtPr,cycles,instrs);
205 #endif 206 #endif
206 } 207 }
207 } 208 }
208 209
209 } 210 }