# HG changeset patch # User Nina Engelhardt # Date 1314637926 -7200 # Node ID ce02441b77cfdcbb1e3d19fd20590147c9ab9cd7 # Parent 73fc5aafbe45c8e69d7f6b4916685f1755a474f6 dependency tracking diff -r 73fc5aafbe45 -r ce02441b77cf Counters/Counters.c --- a/Counters/Counters.c Wed Aug 24 16:07:38 2011 +0200 +++ b/Counters/Counters.c Mon Aug 29 19:12:06 2011 +0200 @@ -15,7 +15,7 @@ } void print_record_csv(CounterRecord* record) { - //Columns are VP,ret_addr, (core,cycles,instrs)* for each savepoint, blocked,unblocked + //Columns are VP,task,ret_addr, (core,cycles,instrs)* for each savepoint, blocked,unblocked printf("%d,%d,%p,",record->vp_id,record->task_position,record->addr_of_libcall_for_req); printf("%d,%lu,%lu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs); printf("%d,%lu,%lu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs); diff -r 73fc5aafbe45 -r ce02441b77cf MasterLoop.c --- a/MasterLoop.c Wed Aug 24 16:07:38 2011 +0200 +++ b/MasterLoop.c Mon Aug 29 19:12:06 2011 +0200 @@ -155,7 +155,7 @@ //End of task, start of next task //print counters from last run print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput); - print_record_human_readable(lastRecord); + //print_record_human_readable(lastRecord); //create new entry in record array CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); newRecord->req_core = thisCoresIdx; diff -r 73fc5aafbe45 -r ce02441b77cf ProcrContext.c --- a/ProcrContext.c Wed Aug 24 16:07:38 2011 +0200 +++ b/ProcrContext.c Mon Aug 29 19:12:06 2011 +0200 @@ -61,7 +61,7 @@ #endif #ifdef MEAS__PERF_COUNTERS newPr->counter_history = VMS__malloc(10*sizeof(void*)); - newPr->counter_history_array_info = makePrivDynArrayInfoFrom(&(newPr->counter_history),10); + newPr->counter_history_array_info = makePrivDynArrayInfoFrom((void*)&(newPr->counter_history),10); CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); newRecord->task_position = 0; newRecord->vp_id = newPr->procrID; diff -r 73fc5aafbe45 -r ce02441b77cf VMS.c --- a/VMS.c Wed Aug 24 16:07:38 2011 +0200 +++ b/VMS.c Mon Aug 29 19:12:06 2011 +0200 @@ -186,6 +186,11 @@ MakeTheMeasHists(); + #ifdef DETECT_DEPENDENCIES + _VMSMasterEnv->dependencies = VMS__malloc(10*sizeof(void*)); + _VMSMasterEnv->dependenciesInfo = makePrivDynArrayInfoFrom((void***)&(_VMSMasterEnv->dependencies),10); + #endif + #ifdef MEAS__PERF_COUNTERS //printf("Creating HW counters..."); FILE* output; @@ -771,6 +776,29 @@ //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&printHist ); //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&saveHistToFile); //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &freeHistExt ); +#ifdef DETECT_DEPENDENCIES + FILE* output; + int n; + char filename[255]; + for(n=0;n<255;n++) + { + sprintf(filename, "./counters/Dependencies.%d.csv",n); + output = fopen(filename,"r"); + if(output) + { + fclose(output); + }else{ + break; + } + } + printf("Saving Dependencies to File: %s ...\n", filename); + output = fopen(filename,"w+"); + set_dependency_file(output); + fprintf(output,"digraph Dependencies {\n"); + + forAllInDynArrayDo( _VMSMasterEnv->dependenciesInfo, &print_dependency_to_file ); + fprintf(output,"}\n"); +#endif #ifdef MEAS__TIME_PLUGIN printHist( _VMSMasterEnv->reqHdlrLowTimeHist ); saveHistToFile( _VMSMasterEnv->reqHdlrLowTimeHist ); diff -r 73fc5aafbe45 -r ce02441b77cf VMS.h --- a/VMS.h Wed Aug 24 16:07:38 2011 +0200 +++ b/VMS.h Mon Aug 29 19:12:06 2011 +0200 @@ -17,6 +17,7 @@ #include "Hash_impl/PrivateHash.h" #include "vmalloc.h" #include "Counters/Counters.h" +#include "dependency.h" #include #include @@ -38,10 +39,11 @@ //These defines turn types of bug messages on and off // be sure debug messages are un-commented (next block of defines) -#define dbgAppFlow TRUE /* Top level flow of application code -- general*/ +#define dbgAppFlow FALSE /* Top level flow of application code -- general*/ #define dbgProbes FALSE /* for issues inside probes themselves*/ #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/ -#define dbgRqstHdlr TRUE /* in request handler code*/ +#define dbgRqstHdlr FALSE /* in request handler code*/ +#define dbgDependency TRUE /* in request handler code, print dependencies */ //Comment or un- the substitute half to turn on/off types of debug message #define DEBUG( bool, msg) \ @@ -74,6 +76,7 @@ //#define NUM_TSC_ROUND_TRIPS 10 #define MEAS__PERF_COUNTERS +#define DETECT_DEPENDENCIES //========================= Hardware related Constants ===================== //This value is the number of hardware threads in the shared memory @@ -269,6 +272,10 @@ int instrs_counter_fd[NUM_CORES]; FILE* counteroutput; #endif + #ifdef DETECT_DEPENDENCIES + Dependency** dependencies; + PrivDynArrayInfo* dependenciesInfo; + #endif } MasterEnv; diff -r 73fc5aafbe45 -r ce02441b77cf dependency.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dependency.c Mon Aug 29 19:12:06 2011 +0200 @@ -0,0 +1,19 @@ +#include "dependency.h" +#include "vmalloc.h" + +Dependency* new_dependency(int from_vp, int from_task, int to_vp, int to_task){ + Dependency* newDep = (Dependency*) VMS__malloc(sizeof(Dependency)); + newDep->from_vp = from_vp; + newDep->from_task = from_task; + newDep->to_vp = to_vp; + newDep->to_task = to_task; + return newDep; +} + +int set_dependency_file(FILE* file){ + dependency_file = file; +} + +void print_dependency_to_file(Dependency* dep){ + fprintf(dependency_file,"VP_%d_%d -> VP_%d_%d;\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task); +} diff -r 73fc5aafbe45 -r ce02441b77cf dependency.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dependency.h Mon Aug 29 19:12:06 2011 +0200 @@ -0,0 +1,32 @@ +/* + * File: dependency.h + * Author: engelhardt + * + * Created on 29. August 2011, 17:41 + */ + +#ifndef DEPENDENCY_H +#define DEPENDENCY_H + +#include "DynArray/DynArray.h" +#include + + + +typedef struct { + int from_vp; + int from_task; + int to_vp; + int to_task; +} Dependency; + +FILE* dependency_file; + +Dependency* new_dependency(int from_vp, int from_task, int to_vp, int to_task); + +int set_dependency_file(FILE* file); + +void print_dependency_to_file(Dependency* dep); + +#endif /* DEPENDENCY_H */ +