Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison MasterLoop.c @ 109:659299627e70
counters done
| author | Nina Engelhardt |
|---|---|
| date | Tue, 02 Aug 2011 17:16:12 +0200 |
| parents | 3bc3b89630c7 |
| children | 724c7a0b687f |
comparison
equal
deleted
inserted
replaced
| 26:8eec3fda183b | 27:4a706503d149 |
|---|---|
| 145 //====================== MEASUREMENT STUFF =================== | 145 //====================== MEASUREMENT STUFF =================== |
| 146 #ifdef MEAS__TIME_PLUGIN | 146 #ifdef MEAS__TIME_PLUGIN |
| 147 int32 startStamp1, endStamp1; | 147 int32 startStamp1, endStamp1; |
| 148 saveLowTimeStampCountInto( startStamp1 ); | 148 saveLowTimeStampCountInto( startStamp1 ); |
| 149 #endif | 149 #endif |
| 150 #ifdef MEAS__PERF_COUNTER | 150 #ifdef MEAS__PERF_COUNTERS |
| 151 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; | 151 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; |
| 152 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; | 152 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; |
| 153 lastRecord->req_core = thisCoresIdx; | 153 lastRecord->req_core = thisCoresIdx; |
| 154 int cycles_fd = masterEnv->cycles_counter_fd[thisCoresIdx]; | 154 saveCyclesAndInstrs(thisCoresIdx,lastRecord->req_cycles,lastRecord->req_instrs); |
| 155 int instrs_fd = masterEnv->instrs_counter_fd[thisCoresIdx]; | |
| 156 int nread; | |
| 157 | |
| 158 nread = read(cycles_fd,&(lastRecord->req_cycles),sizeof(lastRecord->req_cycles)); | |
| 159 if(nread<0){ | |
| 160 lastRecord->req_cycles = 0; | |
| 161 } | |
| 162 | |
| 163 nread = read(instrs_fd,&(lastRecord->req_instrs),sizeof(lastRecord->req_instrs)); | |
| 164 if(nread<0){ | |
| 165 lastRecord->req_instrs = 0; | |
| 166 } | |
| 167 //End of task, start of next task | 155 //End of task, start of next task |
| 168 //print counters from last run | 156 //print counters from last run |
| 169 print_record(lastRecord); | 157 print_record(lastRecord); |
| 170 //create new entry in record array here | 158 //create new entry in record array |
| 171 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); | 159 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); |
| 172 newRecord->req_core = thisCoresIdx; | 160 newRecord->req_core = thisCoresIdx; |
| 161 newRecord->vp_id = currSlot->procrAssignedToSlot->procrID; | |
| 173 addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info); | 162 addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info); |
| 174 lastRecord = newRecord; | 163 lastRecord = newRecord; |
| 175 #endif | 164 #endif |
| 176 //============================================================ | 165 //============================================================ |
| 177 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); | 166 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); |
| 181 addIntervalToHist( startStamp1, endStamp1, | 170 addIntervalToHist( startStamp1, endStamp1, |
| 182 _VMSMasterEnv->reqHdlrLowTimeHist ); | 171 _VMSMasterEnv->reqHdlrLowTimeHist ); |
| 183 addIntervalToHist( startStamp1, endStamp1, | 172 addIntervalToHist( startStamp1, endStamp1, |
| 184 _VMSMasterEnv->reqHdlrHighTimeHist ); | 173 _VMSMasterEnv->reqHdlrHighTimeHist ); |
| 185 #endif | 174 #endif |
| 186 #ifdef MEAS__PERF_COUNTER | 175 #ifdef MEAS__PERF_COUNTERS |
| 187 | 176 //done with constraints check |
| 188 nread = read(cycles_fd,&(lastRecord->sc_done_cycles),sizeof(lastRecord->sc_done_cycles)); | 177 saveCyclesAndInstrs(thisCoresIdx,lastRecord->sc_done_cycles,lastRecord->sc_done_instrs); |
| 189 if(nread<0){ | 178 saveLowTimeStampCountInto(lastRecord->blocked_timestamp); |
| 190 lastRecord->sc_done_cycles = 0; | |
| 191 } | |
| 192 nread = read(instrs_fd,&(lastRecord->sc_done_instrs),sizeof(lastRecord->sc_done_instrs)); | |
| 193 if(nread<0){ | |
| 194 lastRecord->sc_done_instrs = 0; | |
| 195 } | |
| 196 #endif | 179 #endif |
| 197 //============================================================ | 180 //============================================================ |
| 198 } | 181 } |
| 199 if( currSlot->needsProcrAssigned ) | 182 if( currSlot->needsProcrAssigned ) |
| 200 { //give slot a new virt procr | 183 { //give slot a new virt procr |
| 201 #ifdef MEAS__PERF_COUNTER | 184 #ifdef MEAS__PERF_COUNTERS |
| 202 //start assigner | 185 //start assigner |
| 203 int cycles_fd = masterEnv->cycles_counter_fd[thisCoresIdx]; | |
| 204 int instrs_fd = masterEnv->instrs_counter_fd[thisCoresIdx]; | |
| 205 uint64 tmp_cycles; | 186 uint64 tmp_cycles; |
| 206 uint64 tmp_instrs; | 187 uint64 tmp_instrs; |
| 207 int nread=0; | 188 saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs); |
| 208 | |
| 209 nread = read(cycles_fd,&tmp_cycles,sizeof(uint64)); | |
| 210 if(nread<0){ | |
| 211 tmp_cycles = 0; | |
| 212 } | |
| 213 | |
| 214 nread = read(instrs_fd,&tmp_instrs,sizeof(uint64)); | |
| 215 if(nread<0){ | |
| 216 tmp_instrs = 0; | |
| 217 } | |
| 218 #endif | 189 #endif |
| 219 schedVirtPr = | 190 schedVirtPr = |
| 220 (*slaveScheduler)( semanticEnv, thisCoresIdx ); | 191 (*slaveScheduler)( semanticEnv, thisCoresIdx ); |
| 221 #ifdef MEAS__PERF_COUNTER | 192 |
| 193 if( schedVirtPr != NULL ) | |
| 194 { currSlot->procrAssignedToSlot = schedVirtPr; | |
| 195 schedVirtPr->schedSlot = currSlot; | |
| 196 currSlot->needsProcrAssigned = FALSE; | |
| 197 numSlotsFilled += 1; | |
| 198 #ifdef MEAS__PERF_COUNTERS | |
| 222 //end assigner | 199 //end assigner |
| 223 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; | 200 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; |
| 224 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; | 201 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; |
| 225 lastRecord->assigning_core = thisCoresIdx; | 202 lastRecord->assigning_core = thisCoresIdx; |
| 226 lastRecord->start_assign_cycles = tmp_cycles; | 203 lastRecord->start_assign_cycles = tmp_cycles; |
| 227 lastRecord->start_assign_instrs = tmp_instrs; | 204 lastRecord->start_assign_instrs = tmp_instrs; |
| 228 | 205 saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); |
| 229 nread = read(cycles_fd,&(lastRecord->end_assign_cycles),sizeof(lastRecord->end_assign_cycles)); | 206 #endif |
| 230 if(nread<0){ | |
| 231 lastRecord->end_assign_cycles = 0; | |
| 232 } | |
| 233 | |
| 234 nread = read(instrs_fd,&(lastRecord->end_assign_instrs),sizeof(lastRecord->end_assign_instrs)); | |
| 235 if(nread<0){ | |
| 236 lastRecord->end_assign_instrs = 0; | |
| 237 } | |
| 238 #endif | |
| 239 if( schedVirtPr != NULL ) | |
| 240 { currSlot->procrAssignedToSlot = schedVirtPr; | |
| 241 schedVirtPr->schedSlot = currSlot; | |
| 242 currSlot->needsProcrAssigned = FALSE; | |
| 243 numSlotsFilled += 1; | |
| 244 | |
| 245 writeVMSQ( schedVirtPr, readyToAnimateQ ); | 207 writeVMSQ( schedVirtPr, readyToAnimateQ ); |
| 246 } | 208 } |
| 247 } | 209 } |
| 248 } | 210 } |
| 249 | 211 |
