Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison MasterLoop.c @ 185:28cc465f7eb7
new counter interface works now
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Fri, 13 Jan 2012 18:34:31 +0100 |
| parents | 50b29548d4f0 |
| children | 69eb54ce9c4b |
comparison
equal
deleted
inserted
replaced
| 50:770ca77dd226 | 51:8865ccd317de |
|---|---|
| 128 requestHandler = masterEnv->requestHandler; | 128 requestHandler = masterEnv->requestHandler; |
| 129 slaveScheduler = masterEnv->slaveScheduler; | 129 slaveScheduler = masterEnv->slaveScheduler; |
| 130 semanticEnv = masterEnv->semanticEnv; | 130 semanticEnv = masterEnv->semanticEnv; |
| 131 | 131 |
| 132 #ifdef MEAS__PERF_COUNTERS | 132 #ifdef MEAS__PERF_COUNTERS |
| 133 //CounterHandler counterHandler = masterEnv->counterHandler; | 133 CounterHandler counterHandler = masterEnv->counterHandler; |
| 134 #endif | 134 #endif |
| 135 | 135 |
| 136 //Poll each slot's Done flag | 136 //Poll each slot's Done flag |
| 137 numSlotsFilled = 0; | 137 numSlotsFilled = 0; |
| 138 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) | 138 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) |
| 149 #ifdef MEAS__TIME_PLUGIN | 149 #ifdef MEAS__TIME_PLUGIN |
| 150 int32 startStamp1, endStamp1; | 150 int32 startStamp1, endStamp1; |
| 151 saveLowTimeStampCountInto( startStamp1 ); | 151 saveLowTimeStampCountInto( startStamp1 ); |
| 152 #endif | 152 #endif |
| 153 #ifdef MEAS__PERF_COUNTERS | 153 #ifdef MEAS__PERF_COUNTERS |
| 154 int cycles, instrs; | 154 uint64 cycles, instrs; |
| 155 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); | 155 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); |
| 156 //(*counterHandler)(MasterLoop_beforeReqHdlr,thisCoresIdx,slotIdx,currSlot->procrAssignedToSlot,cycles,instrs); | 156 (*counterHandler)(MasterLoop_beforeReqHdlr,currSlot->procrAssignedToSlot,cycles,instrs); |
| 157 | |
| 158 /* | |
| 159 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; | |
| 160 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; | |
| 161 lastRecord->req_core = thisCoresIdx; | |
| 162 saveCyclesAndInstrs(thisCoresIdx,lastRecord->next_task_req_cycles,lastRecord->next_task_req_instrs); | |
| 163 //End of task, start of next task | |
| 164 //print counters from last run | |
| 165 addToDynArray((void*)lastRecord,masterEnv->counter_history_array_info); | |
| 166 print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput); | |
| 167 | |
| 168 //print_record_human_readable(lastRecord); | |
| 169 //create new entry in record array | |
| 170 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); | |
| 171 newRecord->req_core = thisCoresIdx; | |
| 172 newRecord->vp_id = currSlot->procrAssignedToSlot->procrID; | |
| 173 newRecord->task_position = lastRecord->task_position + 1; | |
| 174 newRecord->req_cycles = lastRecord->next_task_req_cycles; | |
| 175 newRecord->req_instrs = lastRecord->next_task_req_instrs; | |
| 176 getReturnAddressBeforeLibraryCall(currSlot->procrAssignedToSlot, &(newRecord->addr_of_libcall_for_req)); | |
| 177 addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info); | |
| 178 lastRecord = newRecord; | |
| 179 */ | |
| 180 #endif | 157 #endif |
| 181 //============================================================ | 158 //============================================================ |
| 182 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); | 159 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); |
| 183 //====================== MEASUREMENT STUFF =================== | 160 //====================== MEASUREMENT STUFF =================== |
| 184 #ifdef MEAS__TIME_PLUGIN | 161 #ifdef MEAS__TIME_PLUGIN |
| 188 addIntervalToHist( startStamp1, endStamp1, | 165 addIntervalToHist( startStamp1, endStamp1, |
| 189 _VMSMasterEnv->reqHdlrHighTimeHist ); | 166 _VMSMasterEnv->reqHdlrHighTimeHist ); |
| 190 #endif | 167 #endif |
| 191 #ifdef MEAS__PERF_COUNTERS | 168 #ifdef MEAS__PERF_COUNTERS |
| 192 //done with constraints check | 169 //done with constraints check |
| 193 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); | 170 uint64 cycles2,instrs2; |
| 194 //(*counterHandler)(MasterLoop_afterReqHdlr,thisCoresIdx,slotIdx,currSlot->procrAssignedToSlot,cycles,instrs); | 171 saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2); |
| 195 /* | 172 (*counterHandler)(MasterLoop_afterReqHdlr,currSlot->procrAssignedToSlot,cycles2,instrs2); |
| 196 saveCyclesAndInstrs(thisCoresIdx,lastRecord->sc_done_cycles,lastRecord->sc_done_instrs); | |
| 197 saveLowTimeStampCountInto(lastRecord->blocked_timestamp); | |
| 198 */ | |
| 199 #endif | 173 #endif |
| 200 //============================================================ | 174 //============================================================ |
| 201 } | 175 } |
| 202 if( currSlot->needsProcrAssigned ) | 176 if( currSlot->needsProcrAssigned ) |
| 203 { //give slot a new virt procr | 177 { //give slot a new virt procr |
| 214 { currSlot->procrAssignedToSlot = schedVirtPr; | 188 { currSlot->procrAssignedToSlot = schedVirtPr; |
| 215 schedVirtPr->schedSlot = currSlot; | 189 schedVirtPr->schedSlot = currSlot; |
| 216 currSlot->needsProcrAssigned = FALSE; | 190 currSlot->needsProcrAssigned = FALSE; |
| 217 numSlotsFilled += 1; | 191 numSlotsFilled += 1; |
| 218 | 192 |
| 193 writeVMSQ( schedVirtPr, readyToAnimateQ ); | |
| 194 | |
| 219 #ifdef MEAS__PERF_COUNTERS | 195 #ifdef MEAS__PERF_COUNTERS |
| 220 uint64 cycles; | 196 uint64 cycles; |
| 221 uint64 instrs; | 197 uint64 instrs; |
| 222 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs); | 198 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs); |
| 223 //(*counterHandler)(MasterLoop_beforeAssign,thisCoresIdx,slotIdx,schedVirtPr,tmp_cycles,tmp_instrs); | 199 (*counterHandler)(MasterLoop_beforeAssign,schedVirtPr,tmp_cycles,tmp_instrs); |
| 224 //(*counterHandler)(MasterLoop_afterAssign,thisCoresIdx,slotIdx,schedVirtPr,cycles,instrs); | 200 (*counterHandler)(MasterLoop_afterAssign,schedVirtPr,cycles,instrs); |
| 225 //end assigner | 201 #endif |
| 226 //int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; | |
| 227 //CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; | |
| 228 //lastRecord->assigning_core = thisCoresIdx; | |
| 229 //lastRecord->start_assign_cycles = tmp_cycles; | |
| 230 //lastRecord->start_assign_instrs = tmp_instrs; | |
| 231 //saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); | |
| 232 #endif | |
| 233 | |
| 234 writeVMSQ( schedVirtPr, readyToAnimateQ ); | |
| 235 } | 202 } |
| 236 } | 203 } |
| 237 | 204 |
| 238 } | 205 } |
| 239 | 206 |
