comparison MasterLoop.c @ 108:3bc3b89630c7

perf counters
author engelhardt@cray1
date Tue, 26 Jul 2011 15:36:24 +0200
parents fe5ec83f1baf
children 659299627e70
comparison
equal deleted inserted replaced
24:e52cd378a27f 26:8eec3fda183b
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
151 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
152 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
153 lastRecord->req_core = thisCoresIdx;
154 int cycles_fd = masterEnv->cycles_counter_fd[thisCoresIdx];
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
168 //print counters from last run
169 print_record(lastRecord);
170 //create new entry in record array here
171 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord));
172 newRecord->req_core = thisCoresIdx;
173 addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info);
174 lastRecord = newRecord;
175 #endif
150 //============================================================ 176 //============================================================
151 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); 177 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv );
152 //====================== MEASUREMENT STUFF =================== 178 //====================== MEASUREMENT STUFF ===================
153 #ifdef MEAS__TIME_PLUGIN 179 #ifdef MEAS__TIME_PLUGIN
154 saveLowTimeStampCountInto( endStamp1 ); 180 saveLowTimeStampCountInto( endStamp1 );
155 addIntervalToHist( startStamp1, endStamp1, 181 addIntervalToHist( startStamp1, endStamp1,
156 _VMSMasterEnv->reqHdlrLowTimeHist ); 182 _VMSMasterEnv->reqHdlrLowTimeHist );
157 addIntervalToHist( startStamp1, endStamp1, 183 addIntervalToHist( startStamp1, endStamp1,
158 _VMSMasterEnv->reqHdlrHighTimeHist ); 184 _VMSMasterEnv->reqHdlrHighTimeHist );
159 #endif 185 #endif
186 #ifdef MEAS__PERF_COUNTER
187
188 nread = read(cycles_fd,&(lastRecord->sc_done_cycles),sizeof(lastRecord->sc_done_cycles));
189 if(nread<0){
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
160 //============================================================ 197 //============================================================
161 } 198 }
162 if( currSlot->needsProcrAssigned ) 199 if( currSlot->needsProcrAssigned )
163 { //give slot a new virt procr 200 { //give slot a new virt procr
201 #ifdef MEAS__PERF_COUNTER
202 //start assigner
203 int cycles_fd = masterEnv->cycles_counter_fd[thisCoresIdx];
204 int instrs_fd = masterEnv->instrs_counter_fd[thisCoresIdx];
205 uint64 tmp_cycles;
206 uint64 tmp_instrs;
207 int nread=0;
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
164 schedVirtPr = 219 schedVirtPr =
165 (*slaveScheduler)( semanticEnv, thisCoresIdx ); 220 (*slaveScheduler)( semanticEnv, thisCoresIdx );
166 221 #ifdef MEAS__PERF_COUNTER
222 //end assigner
223 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
224 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
225 lastRecord->assigning_core = thisCoresIdx;
226 lastRecord->start_assign_cycles = tmp_cycles;
227 lastRecord->start_assign_instrs = tmp_instrs;
228
229 nread = read(cycles_fd,&(lastRecord->end_assign_cycles),sizeof(lastRecord->end_assign_cycles));
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
167 if( schedVirtPr != NULL ) 239 if( schedVirtPr != NULL )
168 { currSlot->procrAssignedToSlot = schedVirtPr; 240 { currSlot->procrAssignedToSlot = schedVirtPr;
169 schedVirtPr->schedSlot = currSlot; 241 schedVirtPr->schedSlot = currSlot;
170 currSlot->needsProcrAssigned = FALSE; 242 currSlot->needsProcrAssigned = FALSE;
171 numSlotsFilled += 1; 243 numSlotsFilled += 1;