diff 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
line diff
     1.1 --- a/MasterLoop.c	Fri Jan 13 15:03:32 2012 +0100
     1.2 +++ b/MasterLoop.c	Fri Jan 13 18:34:31 2012 +0100
     1.3 @@ -130,7 +130,7 @@
     1.4     semanticEnv      = masterEnv->semanticEnv;
     1.5     
     1.6  #ifdef MEAS__PERF_COUNTERS
     1.7 -   //CounterHandler counterHandler = masterEnv->counterHandler;
     1.8 +   CounterHandler counterHandler = masterEnv->counterHandler;
     1.9  #endif
    1.10  
    1.11        //Poll each slot's Done flag
    1.12 @@ -151,32 +151,9 @@
    1.13                 saveLowTimeStampCountInto( startStamp1 );
    1.14                 #endif
    1.15                 #ifdef MEAS__PERF_COUNTERS
    1.16 -               int cycles, instrs;
    1.17 +               uint64 cycles, instrs;
    1.18                 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs);
    1.19 -               //(*counterHandler)(MasterLoop_beforeReqHdlr,thisCoresIdx,slotIdx,currSlot->procrAssignedToSlot,cycles,instrs);
    1.20 -               
    1.21 -               /*
    1.22 -               int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
    1.23 -               CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
    1.24 -               lastRecord->req_core = thisCoresIdx;
    1.25 -               saveCyclesAndInstrs(thisCoresIdx,lastRecord->next_task_req_cycles,lastRecord->next_task_req_instrs);
    1.26 -               //End of task, start of next task
    1.27 -               //print counters from last run
    1.28 -               addToDynArray((void*)lastRecord,masterEnv->counter_history_array_info);
    1.29 -               print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput);
    1.30 -              
    1.31 -               //print_record_human_readable(lastRecord);
    1.32 -               //create new entry in record array
    1.33 -               CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord));
    1.34 -               newRecord->req_core = thisCoresIdx;
    1.35 -               newRecord->vp_id = currSlot->procrAssignedToSlot->procrID;
    1.36 -               newRecord->task_position = lastRecord->task_position + 1;
    1.37 -               newRecord->req_cycles = lastRecord->next_task_req_cycles;
    1.38 -               newRecord->req_instrs = lastRecord->next_task_req_instrs;
    1.39 -               getReturnAddressBeforeLibraryCall(currSlot->procrAssignedToSlot, &(newRecord->addr_of_libcall_for_req));
    1.40 -               addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info);
    1.41 -               lastRecord = newRecord; 
    1.42 -                */
    1.43 +               (*counterHandler)(MasterLoop_beforeReqHdlr,currSlot->procrAssignedToSlot,cycles,instrs);              
    1.44                 #endif
    1.45                 //============================================================
    1.46           (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv );
    1.47 @@ -190,12 +167,9 @@
    1.48                 #endif
    1.49                 #ifdef MEAS__PERF_COUNTERS
    1.50                 //done with constraints check
    1.51 -               saveCyclesAndInstrs(thisCoresIdx,cycles, instrs);
    1.52 -               //(*counterHandler)(MasterLoop_afterReqHdlr,thisCoresIdx,slotIdx,currSlot->procrAssignedToSlot,cycles,instrs);
    1.53 -               /*
    1.54 -               saveCyclesAndInstrs(thisCoresIdx,lastRecord->sc_done_cycles,lastRecord->sc_done_instrs);
    1.55 -               saveLowTimeStampCountInto(lastRecord->blocked_timestamp);
    1.56 -                */
    1.57 +               uint64 cycles2,instrs2;
    1.58 +               saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2);
    1.59 +               (*counterHandler)(MasterLoop_afterReqHdlr,currSlot->procrAssignedToSlot,cycles2,instrs2);
    1.60                 #endif
    1.61                 //============================================================
    1.62         }
    1.63 @@ -216,22 +190,15 @@
    1.64              currSlot->needsProcrAssigned  = FALSE;
    1.65              numSlotsFilled               += 1;
    1.66  
    1.67 +            writeVMSQ( schedVirtPr, readyToAnimateQ );
    1.68 +            
    1.69                 #ifdef MEAS__PERF_COUNTERS
    1.70                 uint64 cycles;
    1.71                 uint64 instrs;
    1.72                 saveCyclesAndInstrs(thisCoresIdx,cycles,instrs);
    1.73 -               //(*counterHandler)(MasterLoop_beforeAssign,thisCoresIdx,slotIdx,schedVirtPr,tmp_cycles,tmp_instrs);
    1.74 -               //(*counterHandler)(MasterLoop_afterAssign,thisCoresIdx,slotIdx,schedVirtPr,cycles,instrs);
    1.75 -               //end assigner
    1.76 -               //int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
    1.77 -               //CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
    1.78 -               //lastRecord->assigning_core = thisCoresIdx;
    1.79 -               //lastRecord->start_assign_cycles = tmp_cycles;
    1.80 -               //lastRecord->start_assign_instrs = tmp_instrs;
    1.81 -               //saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs);
    1.82 +               (*counterHandler)(MasterLoop_beforeAssign,schedVirtPr,tmp_cycles,tmp_instrs);
    1.83 +               (*counterHandler)(MasterLoop_afterAssign,schedVirtPr,cycles,instrs);
    1.84                 #endif
    1.85 -
    1.86 -            writeVMSQ( schedVirtPr, readyToAnimateQ );
    1.87            }
    1.88         }
    1.89