Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
changeset 56:772bb0384074 perf_counters
fix coreloop recording bug and eliminate race condition on measurement-collecting list
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Thu, 09 Feb 2012 15:40:23 +0100 |
| parents | 9d0668e6453f |
| children | 6b723b55b9a0 |
| files | SSR.h SSR_Counter_Recording.c SSR_Counter_Recording.h SSR_lib.c |
| diffstat | 4 files changed, 36 insertions(+), 21 deletions(-) [+] |
line diff
1.1 --- a/SSR.h Fri Feb 03 17:32:57 2012 +0100 1.2 +++ b/SSR.h Thu Feb 09 15:40:23 2012 +0100 1.3 @@ -117,7 +117,7 @@ 1.4 #endif 1.5 1.6 #ifdef MEAS__PERF_COUNTERS 1.7 - ListOfArrays* counterList; 1.8 + ListOfArrays* counterList[NUM_CORES]; 1.9 #endif 1.10 } 1.11 SSRSemEnv;
2.1 --- a/SSR_Counter_Recording.c Fri Feb 03 17:32:57 2012 +0100 2.2 +++ b/SSR_Counter_Recording.c Thu Feb 09 15:40:23 2012 +0100 2.3 @@ -4,29 +4,41 @@ 2.4 2.5 void SSR__init_counter_data_structs(){ 2.6 SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv; 2.7 - semanticEnv->counterList = makeListOfArrays(sizeof(CounterEvent), 128); 2.8 + int i; 2.9 + for(i=0;i<NUM_CORES;i++){ 2.10 + semanticEnv->counterList[i] = makeListOfArrays(sizeof(CounterEvent), 128); 2.11 + } 2.12 } 2.13 2.14 -void SSR__counter_handler(int evt_type, VirtProcr* pr, uint64 cycles, uint64 instrs) 2.15 +void SSR__counter_handler(int evt_type, int vpid, int task, VirtProcr* pr, uint64 cycles, uint64 instrs) 2.16 { 2.17 if(!pr) 2.18 return; 2.19 2.20 //FIXME: find more reliable way to separate master and slave VPs 2.21 - if (pr->procrID < NUM_CORES || pr->procrID > 32) //filters master VPs & shutdown 2.22 + if (pr->isMasterVP || pr->isShutdownVP) //filters master VPs & shutdown 2.23 return; 2.24 2.25 SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv; 2.26 2.27 CounterEvent e; 2.28 e.event_type = evt_type; 2.29 - e.coreID = pr->coreAnimatedBy; 2.30 - e.slot = pr->schedSlot; 2.31 + e.vp = vpid; 2.32 + e.task = task; 2.33 + 2.34 e.cycles = cycles; 2.35 e.instrs = instrs; 2.36 - e.vp = pr->procrID; 2.37 - e.task = pr->numTimesScheduled; 2.38 - addToListOfArrays(CounterEvent,e,semanticEnv->counterList); 2.39 + 2.40 + if(pr){ 2.41 + e.coreID = pr->coreAnimatedBy; 2.42 + e.slot = pr->schedSlot; 2.43 + } 2.44 + 2.45 + int corenum; 2.46 + 2.47 + if(pr) corenum = pr->coreAnimatedBy; else return; 2.48 + 2.49 + addToListOfArrays(CounterEvent,e,semanticEnv->counterList[corenum]); 2.50 2.51 } 2.52 2.53 @@ -38,30 +50,30 @@ 2.54 CounterEvent* e = (CounterEvent*) _e; 2.55 fprintf(counterfile, "event, "); 2.56 switch(e->event_type){ 2.57 - case MasterLoop_beforeReqHdlr: 2.58 + case AppResponderInvocation_start: 2.59 + fprintf(counterfile, "AppResponderInvocation_start"); 2.60 + break; 2.61 + case AppResponder_start: 2.62 fprintf(counterfile, "MasterLoop_beforeReqHdlr"); 2.63 break; 2.64 - case MasterLoop_afterReqHdlr: 2.65 + case AppResponder_end: 2.66 fprintf(counterfile, "MasterLoop_afterReqHdlr"); 2.67 break; 2.68 - case MasterLoop_beforeAssign: 2.69 + case Assigner_start: 2.70 fprintf(counterfile, "MasterLoop_beforeAssign"); 2.71 break; 2.72 - case MasterLoop_afterAssign: 2.73 + case Assigner_end: 2.74 fprintf(counterfile, "MasterLoop_afterAssign"); 2.75 break; 2.76 - case CoreLoop_afterWork: 2.77 + case Work_end: 2.78 fprintf(counterfile, "CoreLoop_afterWork"); 2.79 break; 2.80 - case CoreLoop_beforeWork: 2.81 + case Work_start: 2.82 fprintf(counterfile, "CoreLoop_beforeWork"); 2.83 break; 2.84 - case Procr_suspend: 2.85 + case HwResponderInvocation_start: 2.86 fprintf(counterfile, "Procr_suspend"); 2.87 break; 2.88 -// case MasterLoop_beforeNextAssign: 2.89 -// fprintf(counterfile, "MasterLoop_beforeNextAssign"); 2.90 -// break; 2.91 default: 2.92 fprintf(counterfile, "unknown event"); 2.93 }
3.1 --- a/SSR_Counter_Recording.h Fri Feb 03 17:32:57 2012 +0100 3.2 +++ b/SSR_Counter_Recording.h Thu Feb 09 15:40:23 2012 +0100 3.3 @@ -24,7 +24,7 @@ 3.4 3.5 void SSR__init_counter_data_structs(); 3.6 3.7 -void SSR__counter_handler(int evt_type, VirtProcr* pr, uint64 cycles, uint64 instrs); 3.8 +void SSR__counter_handler(int evt_type, int vpid, int task, VirtProcr* pr, uint64 cycles, uint64 instrs); 3.9 3.10 void set_counter_file(FILE* f); 3.11
4.1 --- a/SSR_lib.c Fri Feb 03 17:32:57 2012 +0100 4.2 +++ b/SSR_lib.c Thu Feb 09 15:40:23 2012 +0100 4.3 @@ -362,7 +362,10 @@ 4.4 output = fopen(filename,"w+"); 4.5 if(output!=NULL){ 4.6 set_counter_file(output); 4.7 - forAllInListOfArraysDo( semanticEnv->counterList, &print_counter_events_to_file ); 4.8 + int i; 4.9 + for(i=0;i<NUM_CORES;i++){ 4.10 + forAllInListOfArraysDo( semanticEnv->counterList[i], &print_counter_events_to_file ); 4.11 + } 4.12 fflush(output); 4.13 4.14 } else
