Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 129:ce02441b77cf perf_counters
dependency tracking
| author | Nina Engelhardt |
|---|---|
| date | Mon, 29 Aug 2011 19:12:06 +0200 |
| parents | 73fc5aafbe45 |
| children | 5475f90c248a |
| files | Counters/Counters.c MasterLoop.c ProcrContext.c VMS.c VMS.h dependency.c dependency.h |
| diffstat | 7 files changed, 91 insertions(+), 5 deletions(-) [+] |
line diff
1.1 --- a/Counters/Counters.c Wed Aug 24 16:07:38 2011 +0200 1.2 +++ b/Counters/Counters.c Mon Aug 29 19:12:06 2011 +0200 1.3 @@ -15,7 +15,7 @@ 1.4 } 1.5 1.6 void print_record_csv(CounterRecord* record) { 1.7 - //Columns are VP,ret_addr, (core,cycles,instrs)* for each savepoint, blocked,unblocked 1.8 + //Columns are VP,task,ret_addr, (core,cycles,instrs)* for each savepoint, blocked,unblocked 1.9 printf("%d,%d,%p,",record->vp_id,record->task_position,record->addr_of_libcall_for_req); 1.10 printf("%d,%lu,%lu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs); 1.11 printf("%d,%lu,%lu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs);
2.1 --- a/MasterLoop.c Wed Aug 24 16:07:38 2011 +0200 2.2 +++ b/MasterLoop.c Mon Aug 29 19:12:06 2011 +0200 2.3 @@ -155,7 +155,7 @@ 2.4 //End of task, start of next task 2.5 //print counters from last run 2.6 print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput); 2.7 - print_record_human_readable(lastRecord); 2.8 + //print_record_human_readable(lastRecord); 2.9 //create new entry in record array 2.10 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); 2.11 newRecord->req_core = thisCoresIdx;
3.1 --- a/ProcrContext.c Wed Aug 24 16:07:38 2011 +0200 3.2 +++ b/ProcrContext.c Mon Aug 29 19:12:06 2011 +0200 3.3 @@ -61,7 +61,7 @@ 3.4 #endif 3.5 #ifdef MEAS__PERF_COUNTERS 3.6 newPr->counter_history = VMS__malloc(10*sizeof(void*)); 3.7 - newPr->counter_history_array_info = makePrivDynArrayInfoFrom(&(newPr->counter_history),10); 3.8 + newPr->counter_history_array_info = makePrivDynArrayInfoFrom((void*)&(newPr->counter_history),10); 3.9 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); 3.10 newRecord->task_position = 0; 3.11 newRecord->vp_id = newPr->procrID;
4.1 --- a/VMS.c Wed Aug 24 16:07:38 2011 +0200 4.2 +++ b/VMS.c Mon Aug 29 19:12:06 2011 +0200 4.3 @@ -186,6 +186,11 @@ 4.4 4.5 MakeTheMeasHists(); 4.6 4.7 + #ifdef DETECT_DEPENDENCIES 4.8 + _VMSMasterEnv->dependencies = VMS__malloc(10*sizeof(void*)); 4.9 + _VMSMasterEnv->dependenciesInfo = makePrivDynArrayInfoFrom((void***)&(_VMSMasterEnv->dependencies),10); 4.10 + #endif 4.11 + 4.12 #ifdef MEAS__PERF_COUNTERS 4.13 //printf("Creating HW counters..."); 4.14 FILE* output; 4.15 @@ -771,6 +776,29 @@ 4.16 //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&printHist ); 4.17 //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&saveHistToFile); 4.18 //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &freeHistExt ); 4.19 +#ifdef DETECT_DEPENDENCIES 4.20 + FILE* output; 4.21 + int n; 4.22 + char filename[255]; 4.23 + for(n=0;n<255;n++) 4.24 + { 4.25 + sprintf(filename, "./counters/Dependencies.%d.csv",n); 4.26 + output = fopen(filename,"r"); 4.27 + if(output) 4.28 + { 4.29 + fclose(output); 4.30 + }else{ 4.31 + break; 4.32 + } 4.33 + } 4.34 + printf("Saving Dependencies to File: %s ...\n", filename); 4.35 + output = fopen(filename,"w+"); 4.36 + set_dependency_file(output); 4.37 + fprintf(output,"digraph Dependencies {\n"); 4.38 + 4.39 + forAllInDynArrayDo( _VMSMasterEnv->dependenciesInfo, &print_dependency_to_file ); 4.40 + fprintf(output,"}\n"); 4.41 +#endif 4.42 #ifdef MEAS__TIME_PLUGIN 4.43 printHist( _VMSMasterEnv->reqHdlrLowTimeHist ); 4.44 saveHistToFile( _VMSMasterEnv->reqHdlrLowTimeHist );
5.1 --- a/VMS.h Wed Aug 24 16:07:38 2011 +0200 5.2 +++ b/VMS.h Mon Aug 29 19:12:06 2011 +0200 5.3 @@ -17,6 +17,7 @@ 5.4 #include "Hash_impl/PrivateHash.h" 5.5 #include "vmalloc.h" 5.6 #include "Counters/Counters.h" 5.7 +#include "dependency.h" 5.8 5.9 #include <pthread.h> 5.10 #include <sys/time.h> 5.11 @@ -38,10 +39,11 @@ 5.12 5.13 //These defines turn types of bug messages on and off 5.14 // be sure debug messages are un-commented (next block of defines) 5.15 -#define dbgAppFlow TRUE /* Top level flow of application code -- general*/ 5.16 +#define dbgAppFlow FALSE /* Top level flow of application code -- general*/ 5.17 #define dbgProbes FALSE /* for issues inside probes themselves*/ 5.18 #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/ 5.19 -#define dbgRqstHdlr TRUE /* in request handler code*/ 5.20 +#define dbgRqstHdlr FALSE /* in request handler code*/ 5.21 +#define dbgDependency TRUE /* in request handler code, print dependencies */ 5.22 5.23 //Comment or un- the substitute half to turn on/off types of debug message 5.24 #define DEBUG( bool, msg) \ 5.25 @@ -74,6 +76,7 @@ 5.26 //#define NUM_TSC_ROUND_TRIPS 10 5.27 5.28 #define MEAS__PERF_COUNTERS 5.29 +#define DETECT_DEPENDENCIES 5.30 5.31 //========================= Hardware related Constants ===================== 5.32 //This value is the number of hardware threads in the shared memory 5.33 @@ -269,6 +272,10 @@ 5.34 int instrs_counter_fd[NUM_CORES]; 5.35 FILE* counteroutput; 5.36 #endif 5.37 + #ifdef DETECT_DEPENDENCIES 5.38 + Dependency** dependencies; 5.39 + PrivDynArrayInfo* dependenciesInfo; 5.40 + #endif 5.41 } 5.42 MasterEnv; 5.43
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/dependency.c Mon Aug 29 19:12:06 2011 +0200 6.3 @@ -0,0 +1,19 @@ 6.4 +#include "dependency.h" 6.5 +#include "vmalloc.h" 6.6 + 6.7 +Dependency* new_dependency(int from_vp, int from_task, int to_vp, int to_task){ 6.8 + Dependency* newDep = (Dependency*) VMS__malloc(sizeof(Dependency)); 6.9 + newDep->from_vp = from_vp; 6.10 + newDep->from_task = from_task; 6.11 + newDep->to_vp = to_vp; 6.12 + newDep->to_task = to_task; 6.13 + return newDep; 6.14 +} 6.15 + 6.16 +int set_dependency_file(FILE* file){ 6.17 + dependency_file = file; 6.18 +} 6.19 + 6.20 +void print_dependency_to_file(Dependency* dep){ 6.21 + fprintf(dependency_file,"VP_%d_%d -> VP_%d_%d;\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task); 6.22 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/dependency.h Mon Aug 29 19:12:06 2011 +0200 7.3 @@ -0,0 +1,32 @@ 7.4 +/* 7.5 + * File: dependency.h 7.6 + * Author: engelhardt 7.7 + * 7.8 + * Created on 29. August 2011, 17:41 7.9 + */ 7.10 + 7.11 +#ifndef DEPENDENCY_H 7.12 +#define DEPENDENCY_H 7.13 + 7.14 +#include "DynArray/DynArray.h" 7.15 +#include <stdio.h> 7.16 + 7.17 + 7.18 + 7.19 +typedef struct { 7.20 + int from_vp; 7.21 + int from_task; 7.22 + int to_vp; 7.23 + int to_task; 7.24 +} Dependency; 7.25 + 7.26 +FILE* dependency_file; 7.27 + 7.28 +Dependency* new_dependency(int from_vp, int from_task, int to_vp, int to_task); 7.29 + 7.30 +int set_dependency_file(FILE* file); 7.31 + 7.32 +void print_dependency_to_file(Dependency* dep); 7.33 + 7.34 +#endif /* DEPENDENCY_H */ 7.35 +
