# HG changeset patch # User Nina Engelhardt # Date 1326463412 -3600 # Node ID 50b29548d4f0627361ad3522cc717d5935bc83da # Parent 7523ee70d66cdcd30608f9009586d230676564e8 handler interface for counters... not working diff -r 7523ee70d66c -r 50b29548d4f0 CoreLoop.c --- a/CoreLoop.c Fri Jan 06 18:55:05 2012 +0100 +++ b/CoreLoop.c Fri Jan 13 15:03:32 2012 +0100 @@ -86,14 +86,14 @@ while(1){ #ifdef MEAS__PERF_COUNTERS //end work - + /* if(currPr!=NULL){ - int lastRecordIdx = currPr->counter_history_array_info->numInArray -1; - CounterRecord* lastRecord = currPr->counter_history[lastRecordIdx]; - //lastRecord->work_core = thisCoresIdx; - saveCyclesAndInstrs(thisCoresIdx,lastRecord->suspend_cycles,lastRecord->suspend_instrs); + int lastRecordIdx = currPr->counter_history_array_info->numInArray -1; + CounterRecord* lastRecord = currPr->counter_history[lastRecordIdx]; + //lastRecord->work_core = thisCoresIdx; + saveCyclesAndInstrs(thisCoresIdx,lastRecord->suspend_cycles,lastRecord->suspend_instrs); } - + */ #endif //Get virtual processor from queue //The Q must be a global, static volatile var, so not kept in reg, @@ -163,10 +163,12 @@ #ifdef MEAS__PERF_COUNTERS //start work +/* int lastRecordIdx = currPr->counter_history_array_info->numInArray -1; CounterRecord* lastRecord = currPr->counter_history[lastRecordIdx]; lastRecord->work_core = thisCoresIdx; saveCyclesAndInstrs(thisCoresIdx,lastRecord->start_work_cycles,lastRecord->start_work_instrs); +*/ #endif switchToVP(currPr); //The VPs return in here diff -r 7523ee70d66c -r 50b29548d4f0 MasterLoop.c --- a/MasterLoop.c Fri Jan 06 18:55:05 2012 +0100 +++ b/MasterLoop.c Fri Jan 13 15:03:32 2012 +0100 @@ -128,7 +128,10 @@ requestHandler = masterEnv->requestHandler; slaveScheduler = masterEnv->slaveScheduler; semanticEnv = masterEnv->semanticEnv; - + +#ifdef MEAS__PERF_COUNTERS + //CounterHandler counterHandler = masterEnv->counterHandler; +#endif //Poll each slot's Done flag numSlotsFilled = 0; @@ -148,6 +151,11 @@ saveLowTimeStampCountInto( startStamp1 ); #endif #ifdef MEAS__PERF_COUNTERS + int cycles, instrs; + saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); + //(*counterHandler)(MasterLoop_beforeReqHdlr,thisCoresIdx,slotIdx,currSlot->procrAssignedToSlot,cycles,instrs); + + /* int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; lastRecord->req_core = thisCoresIdx; @@ -156,11 +164,7 @@ //print counters from last run addToDynArray((void*)lastRecord,masterEnv->counter_history_array_info); print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput); - - - - //print_record_human_readable(lastRecord); //create new entry in record array CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); @@ -171,7 +175,8 @@ newRecord->req_instrs = lastRecord->next_task_req_instrs; getReturnAddressBeforeLibraryCall(currSlot->procrAssignedToSlot, &(newRecord->addr_of_libcall_for_req)); addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info); - lastRecord = newRecord; + lastRecord = newRecord; + */ #endif //============================================================ (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); @@ -185,8 +190,12 @@ #endif #ifdef MEAS__PERF_COUNTERS //done with constraints check + saveCyclesAndInstrs(thisCoresIdx,cycles, instrs); + //(*counterHandler)(MasterLoop_afterReqHdlr,thisCoresIdx,slotIdx,currSlot->procrAssignedToSlot,cycles,instrs); + /* saveCyclesAndInstrs(thisCoresIdx,lastRecord->sc_done_cycles,lastRecord->sc_done_instrs); saveLowTimeStampCountInto(lastRecord->blocked_timestamp); + */ #endif //============================================================ } @@ -208,13 +217,18 @@ numSlotsFilled += 1; #ifdef MEAS__PERF_COUNTERS + uint64 cycles; + uint64 instrs; + saveCyclesAndInstrs(thisCoresIdx,cycles,instrs); + //(*counterHandler)(MasterLoop_beforeAssign,thisCoresIdx,slotIdx,schedVirtPr,tmp_cycles,tmp_instrs); + //(*counterHandler)(MasterLoop_afterAssign,thisCoresIdx,slotIdx,schedVirtPr,cycles,instrs); //end assigner - int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; - CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; - lastRecord->assigning_core = thisCoresIdx; - lastRecord->start_assign_cycles = tmp_cycles; - lastRecord->start_assign_instrs = tmp_instrs; - saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); + //int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; + //CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; + //lastRecord->assigning_core = thisCoresIdx; + //lastRecord->start_assign_cycles = tmp_cycles; + //lastRecord->start_assign_instrs = tmp_instrs; + //saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); #endif writeVMSQ( schedVirtPr, readyToAnimateQ ); diff -r 7523ee70d66c -r 50b29548d4f0 ProcrContext.c --- a/ProcrContext.c Fri Jan 06 18:55:05 2012 +0100 +++ b/ProcrContext.c Fri Jan 13 15:03:32 2012 +0100 @@ -61,6 +61,7 @@ // _VMSMasterEnv->createPtInSecs; #endif #ifdef MEAS__PERF_COUNTERS +/* newPr->counter_history = VMS__malloc(10*sizeof(void*)); newPr->counter_history_array_info = makePrivDynArrayInfoFrom((void*)&(newPr->counter_history),10); CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); @@ -72,6 +73,7 @@ newRecord->req_cycles = 0; newRecord->req_instrs = 0; addToDynArray( (void*) newRecord, newPr->counter_history_array_info); +*/ #endif //======================================================================== diff -r 7523ee70d66c -r 50b29548d4f0 VMS.c --- a/VMS.c Fri Jan 06 18:55:05 2012 +0100 +++ b/VMS.c Fri Jan 13 15:03:32 2012 +0100 @@ -192,9 +192,12 @@ #endif #ifdef MEAS__PERF_COUNTERS +/* _VMSMasterEnv->counter_history = VMS__malloc(10*sizeof(void*)); _VMSMasterEnv->counter_history_array_info = makePrivDynArrayInfoFrom((void***)&(_VMSMasterEnv->counter_history),10); +*/ //printf("Creating HW counters..."); +/* FILE* output; int n; char filename[255]; @@ -212,6 +215,7 @@ printf("Saving Counter measurements to File: %s ...\n", filename); output = fopen(filename,"w+"); _VMSMasterEnv->counteroutput = output; +*/ struct perf_event_attr hw_event; memset(&hw_event,0,sizeof(hw_event)); diff -r 7523ee70d66c -r 50b29548d4f0 VMS.h --- a/VMS.h Fri Jan 06 18:55:05 2012 +0100 +++ b/VMS.h Fri Jan 13 15:03:32 2012 +0100 @@ -130,7 +130,7 @@ typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr typedef void (*ResumePrFnPtr) ( VirtProcr *, void * ); - +typedef void (*CounterHandler) (int,int,int,VirtProcr*,uint64,uint64); //============= Requests =========== // @@ -210,8 +210,8 @@ unsigned int endMasterTSCLow; #endif #ifdef MEAS__PERF_COUNTERS // - CounterRecord** counter_history; - PrivDynArrayInfo* counter_history_array_info; + //CounterRecord** counter_history; + //PrivDynArrayInfo* counter_history_array_info; #endif //======================================== @@ -276,8 +276,9 @@ FILE* counteroutput; #endif #ifdef MEAS__PERF_COUNTERS // - CounterRecord** counter_history; - PrivDynArrayInfo* counter_history_array_info; + //CounterRecord** counter_history; + //PrivDynArrayInfo* counter_history_array_info; + CounterHandler counterHandler; #endif } MasterEnv; @@ -444,6 +445,13 @@ } \ } while (0) +enum eventType { + MasterLoop_beforeReqHdlr = 1, + MasterLoop_afterReqHdlr, + MasterLoop_beforeAssign, + MasterLoop_afterAssign +}; + #define getReturnAddressBeforeLibraryCall(vp_ptr, res_ptr) do{ \ void* frame_ptr0 = vp_ptr->framePtr; \ void* frame_ptr1 = *((void**)frame_ptr0); \