comparison MasterLoop.c @ 177:3bd35fc83c61

move loopgraph recording to plugin (\! changed scheduler fn prototype \!)
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Wed, 04 Jan 2012 16:40:10 +0100
parents 981acd1db6af
children 7523ee70d66c
comparison
equal deleted inserted replaced
44:6b73db47858f 47:6486bb46d511
130 requestHandler = masterEnv->requestHandler; 130 requestHandler = masterEnv->requestHandler;
131 slaveScheduler = masterEnv->slaveScheduler; 131 slaveScheduler = masterEnv->slaveScheduler;
132 semanticEnv = masterEnv->semanticEnv; 132 semanticEnv = masterEnv->semanticEnv;
133 133
134 #ifdef DETECT_LOOP_GRAPH 134 #ifdef DETECT_LOOP_GRAPH
135 if(numSlotsFilled > 0){ 135
136 b = new_bulb();
137 addToDynArray((void*)b,masterEnv->loop_graph_array_info);
138 set_bulb_core(b,thisCoresIdx);
139 set_bulb_id(b,masterEnv->loop_counter[thisCoresIdx]++);
140 }
141 #endif 136 #endif
142 137
143 //Poll each slot's Done flag 138 //Poll each slot's Done flag
144 numSlotsFilled = 0; 139 numSlotsFilled = 0;
145 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) 140 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++)
207 uint64 tmp_cycles; 202 uint64 tmp_cycles;
208 uint64 tmp_instrs; 203 uint64 tmp_instrs;
209 saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs); 204 saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs);
210 #endif 205 #endif
211 schedVirtPr = 206 schedVirtPr =
212 (*slaveScheduler)( semanticEnv, thisCoresIdx ); 207 (*slaveScheduler)( semanticEnv, thisCoresIdx, slotIdx );
213 208
214 if( schedVirtPr != NULL ) 209 if( schedVirtPr != NULL )
215 { currSlot->procrAssignedToSlot = schedVirtPr; 210 { currSlot->procrAssignedToSlot = schedVirtPr;
216 schedVirtPr->schedSlot = currSlot; 211 schedVirtPr->schedSlot = currSlot;
217 currSlot->needsProcrAssigned = FALSE; 212 currSlot->needsProcrAssigned = FALSE;
218 numSlotsFilled += 1; 213 numSlotsFilled += 1;
219 schedVirtPr->numTimesScheduled++; 214
220 #ifdef MEAS__PERF_COUNTERS 215 #ifdef MEAS__PERF_COUNTERS
221 //end assigner 216 //end assigner
222 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; 217 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
223 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; 218 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
224 lastRecord->assigning_core = thisCoresIdx; 219 lastRecord->assigning_core = thisCoresIdx;
225 lastRecord->start_assign_cycles = tmp_cycles; 220 lastRecord->start_assign_cycles = tmp_cycles;
226 lastRecord->start_assign_instrs = tmp_instrs; 221 lastRecord->start_assign_instrs = tmp_instrs;
227 saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); 222 saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs);
228 #endif 223 #endif
224 #ifdef DETECT_LOOP_GRAPH
225
226 #endif
229 writeVMSQ( schedVirtPr, readyToAnimateQ ); 227 writeVMSQ( schedVirtPr, readyToAnimateQ );
230 } 228 }
231 } 229 }
232 #ifdef DETECT_LOOP_GRAPH 230
233 if(!currSlot->needsProcrAssigned) {
234 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
235 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
236 set_bulb_member(b,slotIdx,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position);
237 }
238 #endif
239 } 231 }
240 232
241 233
242 #ifdef USE_WORK_STEALING 234 #ifdef USE_WORK_STEALING
243 //If no slots filled, means no more work, look for work to steal. 235 //If no slots filled, means no more work, look for work to steal.