# HG changeset patch # User Nina Engelhardt # Date 1328798423 -3600 # Node ID 772bb038407407d1e0f9533d953a09c0dcf8f8c3 # Parent 9d0668e6453f80665cef163bdfa33f8fe0b2d4c5 fix coreloop recording bug and eliminate race condition on measurement-collecting list diff -r 9d0668e6453f -r 772bb0384074 SSR.h --- a/SSR.h Fri Feb 03 17:32:57 2012 +0100 +++ b/SSR.h Thu Feb 09 15:40:23 2012 +0100 @@ -117,7 +117,7 @@ #endif #ifdef MEAS__PERF_COUNTERS - ListOfArrays* counterList; + ListOfArrays* counterList[NUM_CORES]; #endif } SSRSemEnv; diff -r 9d0668e6453f -r 772bb0384074 SSR_Counter_Recording.c --- a/SSR_Counter_Recording.c Fri Feb 03 17:32:57 2012 +0100 +++ b/SSR_Counter_Recording.c Thu Feb 09 15:40:23 2012 +0100 @@ -4,29 +4,41 @@ void SSR__init_counter_data_structs(){ SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv; - semanticEnv->counterList = makeListOfArrays(sizeof(CounterEvent), 128); + int i; + for(i=0;icounterList[i] = makeListOfArrays(sizeof(CounterEvent), 128); + } } -void SSR__counter_handler(int evt_type, VirtProcr* pr, uint64 cycles, uint64 instrs) +void SSR__counter_handler(int evt_type, int vpid, int task, VirtProcr* pr, uint64 cycles, uint64 instrs) { if(!pr) return; //FIXME: find more reliable way to separate master and slave VPs - if (pr->procrID < NUM_CORES || pr->procrID > 32) //filters master VPs & shutdown + if (pr->isMasterVP || pr->isShutdownVP) //filters master VPs & shutdown return; SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv; CounterEvent e; e.event_type = evt_type; - e.coreID = pr->coreAnimatedBy; - e.slot = pr->schedSlot; + e.vp = vpid; + e.task = task; + e.cycles = cycles; e.instrs = instrs; - e.vp = pr->procrID; - e.task = pr->numTimesScheduled; - addToListOfArrays(CounterEvent,e,semanticEnv->counterList); + + if(pr){ + e.coreID = pr->coreAnimatedBy; + e.slot = pr->schedSlot; + } + + int corenum; + + if(pr) corenum = pr->coreAnimatedBy; else return; + + addToListOfArrays(CounterEvent,e,semanticEnv->counterList[corenum]); } @@ -38,30 +50,30 @@ CounterEvent* e = (CounterEvent*) _e; fprintf(counterfile, "event, "); switch(e->event_type){ - case MasterLoop_beforeReqHdlr: + case AppResponderInvocation_start: + fprintf(counterfile, "AppResponderInvocation_start"); + break; + case AppResponder_start: fprintf(counterfile, "MasterLoop_beforeReqHdlr"); break; - case MasterLoop_afterReqHdlr: + case AppResponder_end: fprintf(counterfile, "MasterLoop_afterReqHdlr"); break; - case MasterLoop_beforeAssign: + case Assigner_start: fprintf(counterfile, "MasterLoop_beforeAssign"); break; - case MasterLoop_afterAssign: + case Assigner_end: fprintf(counterfile, "MasterLoop_afterAssign"); break; - case CoreLoop_afterWork: + case Work_end: fprintf(counterfile, "CoreLoop_afterWork"); break; - case CoreLoop_beforeWork: + case Work_start: fprintf(counterfile, "CoreLoop_beforeWork"); break; - case Procr_suspend: + case HwResponderInvocation_start: fprintf(counterfile, "Procr_suspend"); break; -// case MasterLoop_beforeNextAssign: -// fprintf(counterfile, "MasterLoop_beforeNextAssign"); -// break; default: fprintf(counterfile, "unknown event"); } diff -r 9d0668e6453f -r 772bb0384074 SSR_Counter_Recording.h --- a/SSR_Counter_Recording.h Fri Feb 03 17:32:57 2012 +0100 +++ b/SSR_Counter_Recording.h Thu Feb 09 15:40:23 2012 +0100 @@ -24,7 +24,7 @@ void SSR__init_counter_data_structs(); -void SSR__counter_handler(int evt_type, VirtProcr* pr, uint64 cycles, uint64 instrs); +void SSR__counter_handler(int evt_type, int vpid, int task, VirtProcr* pr, uint64 cycles, uint64 instrs); void set_counter_file(FILE* f); diff -r 9d0668e6453f -r 772bb0384074 SSR_lib.c --- a/SSR_lib.c Fri Feb 03 17:32:57 2012 +0100 +++ b/SSR_lib.c Thu Feb 09 15:40:23 2012 +0100 @@ -362,7 +362,10 @@ output = fopen(filename,"w+"); if(output!=NULL){ set_counter_file(output); - forAllInListOfArraysDo( semanticEnv->counterList, &print_counter_events_to_file ); + int i; + for(i=0;icounterList[i], &print_counter_events_to_file ); + } fflush(output); } else