Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
changeset 51:323418163771 perf_counters
new counter interface works now
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Fri, 13 Jan 2012 18:34:37 +0100 |
| parents | 5c59bfe62d92 |
| children | 8035f05442c0 |
| files | SSR_Counter_Recording.c SSR_Counter_Recording.h SSR_PluginFns.c SSR_lib.c |
| diffstat | 4 files changed, 61 insertions(+), 16 deletions(-) [+] |
line diff
1.1 --- a/SSR_Counter_Recording.c Fri Jan 13 15:03:20 2012 +0100 1.2 +++ b/SSR_Counter_Recording.c Fri Jan 13 18:34:37 2012 +0100 1.3 @@ -7,18 +7,29 @@ 1.4 semanticEnv->counterList = makeListOfArrays(sizeof(CounterEvent), 128); 1.5 } 1.6 1.7 -void SSR__counter_handler(int evt_type, int coreID, int slotID, VirtProcr* pr, uint64 cycles, uint64 instrs) 1.8 +void SSR__counter_handler(int evt_type, VirtProcr* pr, uint64 cycles, uint64 instrs) 1.9 { 1.10 -/* 1.11 + 1.12 SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv; 1.13 1.14 CounterEvent e; 1.15 e.event_type = evt_type; 1.16 - e.coreID = coreID; 1.17 - e.slotID = slotID; 1.18 + e.coreID = pr->coreAnimatedBy; 1.19 + e.slotID = pr->schedSlot; 1.20 e.cycles = cycles; 1.21 e.instrs = instrs; 1.22 - 1.23 + e.vp = pr->procrID; 1.24 + e.task = pr->numTimesScheduled; 1.25 addToListOfArrays(CounterEvent,e,semanticEnv->counterList); 1.26 -*/ 1.27 + 1.28 +} 1.29 + 1.30 +void set_counter_file(FILE* f){ 1.31 + counterfile = f; 1.32 +} 1.33 + 1.34 +void print_counter_events_to_file(void* _e){ 1.35 + CounterEvent* e = (CounterEvent*) _e; 1.36 + 1.37 + fprintf(counterfile, "event, %d, %d, %d, %llu, %llu\n",e->event_type,e->vp,e->task,e->cycles,e->instrs); 1.38 } 1.39 \ No newline at end of file
2.1 --- a/SSR_Counter_Recording.h Fri Jan 13 15:03:20 2012 +0100 2.2 +++ b/SSR_Counter_Recording.h Fri Jan 13 18:34:37 2012 +0100 2.3 @@ -14,13 +14,20 @@ 2.4 int event_type; 2.5 int coreID; 2.6 int slotID; 2.7 + int vp; 2.8 + int task; 2.9 uint64 cycles; 2.10 uint64 instrs; 2.11 } CounterEvent; 2.12 2.13 +FILE* counterfile; 2.14 + 2.15 void SSR__init_counter_data_structs(); 2.16 2.17 -void SSR__counter_handler(int evt_type, int coreID, int slotID, VirtProcr* pr, uint64 cycles, uint64 instrs); 2.18 +void SSR__counter_handler(int evt_type, VirtProcr* pr, uint64 cycles, uint64 instrs); 2.19 2.20 +void set_counter_file(FILE* f); 2.21 + 2.22 +void print_counter_events_to_file(void* _e); 2.23 #endif /* SSR_COUNTER_RECORDING_H */ 2.24
3.1 --- a/SSR_PluginFns.c Fri Jan 13 15:03:20 2012 +0100 3.2 +++ b/SSR_PluginFns.c Fri Jan 13 18:34:37 2012 +0100 3.3 @@ -260,14 +260,15 @@ 3.4 newu.vp = procr->procrID; 3.5 newu.task = procr->numTimesScheduled + 1; 3.6 addToListOfArrays(Unit,newu,semEnv->unitList); 3.7 - //addToListOfArraysUnit(newu,semEnv->unitList); 3.8 - Dependency newd; 3.9 - newd.from_vp = procr->procrID; 3.10 - newd.from_task = procr->numTimesScheduled; 3.11 - newd.to_vp = procr->procrID; 3.12 - newd.to_task = procr->numTimesScheduled + 1; 3.13 - //addToListOfArraysDependency(newd,semEnv->ctlDependenciesList); 3.14 - addToListOfArrays(Dependency, newd ,semEnv->ctlDependenciesList); 3.15 + 3.16 + if (procr->numTimesScheduled > 0){ 3.17 + Dependency newd; 3.18 + newd.from_vp = procr->procrID; 3.19 + newd.from_task = procr->numTimesScheduled; 3.20 + newd.to_vp = procr->procrID; 3.21 + newd.to_task = procr->numTimesScheduled + 1; 3.22 + addToListOfArrays(Dependency, newd ,semEnv->ctlDependenciesList); 3.23 + } 3.24 #endif 3.25 writePrivQ( procr, semEnv->readyVPQs[ procr->coreAnimatedBy] ); 3.26 }
4.1 --- a/SSR_lib.c Fri Jan 13 15:03:20 2012 +0100 4.2 +++ b/SSR_lib.c Fri Jan 13 18:34:37 2012 +0100 4.3 @@ -345,7 +345,33 @@ 4.4 freeListOfArrays(semanticEnv->dynDependenciesList); 4.5 4.6 #endif 4.7 - 4.8 +#ifdef MEAS__PERF_COUNTERS 4.9 + for(n=0;n<255;n++) 4.10 + { 4.11 + sprintf(filename, "./counters/Counters.%d.csv",n); 4.12 + output = fopen(filename,"r"); 4.13 + if(output) 4.14 + { 4.15 + fclose(output); 4.16 + }else{ 4.17 + break; 4.18 + } 4.19 + } 4.20 + if(n<255){ 4.21 + printf("Saving Counter measurements to File: %s ...\n", filename); 4.22 + output = fopen(filename,"w+"); 4.23 + if(output!=NULL){ 4.24 + set_counter_file(output); 4.25 + forAllInListOfArraysDo( semanticEnv->counterList, &print_counter_events_to_file ); 4.26 + fflush(output); 4.27 + 4.28 + } else 4.29 + printf("Opening UCC file failed. Please check that folder \"counters\" exists in run directory and has write permission.\n"); 4.30 + } else { 4.31 + printf("Could not open UCC file, please clean \"counters\" folder. (Must contain less than 255 files.)\n"); 4.32 + } 4.33 + 4.34 +#endif 4.35 /* It's all allocated inside VMS's big chunk -- that's about to be freed, so 4.36 * nothing to do here 4.37
