# HG changeset patch # User Nina Engelhardt # Date 1315394790 -7200 # Node ID 5475f90c248a51e997ca34659786e3bd14eb7a49 # Parent ce02441b77cfdcbb1e3d19fd20590147c9ab9cd7 fix outputs (dependency file creation, counter length) diff -r ce02441b77cf -r 5475f90c248a Counters/Counters.c --- a/Counters/Counters.c Mon Aug 29 19:12:06 2011 +0200 +++ b/Counters/Counters.c Wed Sep 07 13:26:30 2011 +0200 @@ -4,25 +4,25 @@ void print_record_human_readable(CounterRecord* record){ printf("=== Loop Stats (VP %d # %d suspended at %p): ===\n",record->vp_id,record->task_position,record->addr_of_libcall_for_req); - printf("Constraints check done:\t%lu cycles, %lu instrs [Core %d]\n",record->sc_done_cycles,record->sc_done_instrs,record->req_core); + printf("Constraints check done:\t%llu cycles, %llu instrs [Core %d]\n",record->sc_done_cycles,record->sc_done_instrs,record->req_core); printf("Time in ready queue:\tblocked at %u, unblocked at %u\n",record->blocked_timestamp,record->unblocked_timestamp); - printf("Assigner started:\t%lu cycles, %lu instrs [Core %d]\n",record->start_assign_cycles,record->start_assign_instrs,record->assigning_core); - printf("Assigner ended: \t%lu cycles, %lu instrs [Core %d]\n",record->end_assign_cycles,record->end_assign_instrs,record->assigning_core); - printf("Work+comm started:\t%lu cycles, %lu instrs [Core %d]\n",record->start_work_cycles,record->start_work_instrs,record->work_core); - printf("Work+comm ended:\t%lu cycles, %lu instrs [Core %d]\n",record->suspend_cycles,record->suspend_instrs,record->work_core); - printf("Status request read:\t%lu cycles, %lu instrs [Core %d]\n",record->req_cycles,record->req_instrs,record->req_core); + printf("Assigner started:\t%llu cycles, %llu instrs [Core %d]\n",record->start_assign_cycles,record->start_assign_instrs,record->assigning_core); + printf("Assigner ended: \t%llu cycles, %llu instrs [Core %d]\n",record->end_assign_cycles,record->end_assign_instrs,record->assigning_core); + printf("Work+comm started:\t%llu cycles, %llu instrs [Core %d]\n",record->start_work_cycles,record->start_work_instrs,record->work_core); + printf("Work+comm ended:\t%llu cycles, %llu instrs [Core %d]\n",record->suspend_cycles,record->suspend_instrs,record->work_core); + printf("Status request read:\t%llu cycles, %llu instrs [Core %d]\n",record->req_cycles,record->req_instrs,record->req_core); fflush(stdin); } void print_record_csv(CounterRecord* record) { //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); - printf("%d,%lu,%lu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs); - printf("%d,%lu,%lu,",record->work_core,record->start_work_cycles,record->start_work_instrs); - printf("%d,%lu,%lu,",record->work_core,record->suspend_cycles,record->suspend_instrs); - printf("%d,%lu,%lu,",record->req_core,record->req_cycles,record->req_instrs); + printf("%d,%llu,%llu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs); + printf("%d,%llu,%llu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs); + printf("%d,%llu,%llu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs); + printf("%d,%llu,%llu,",record->work_core,record->start_work_cycles,record->start_work_instrs); + printf("%d,%llu,%llu,",record->work_core,record->suspend_cycles,record->suspend_instrs); + printf("%d,%llu,%llu,",record->req_core,record->req_cycles,record->req_instrs); printf("%u,%u\n",record->blocked_timestamp,record->unblocked_timestamp); fflush(stdin); } @@ -30,11 +30,11 @@ void print_record_csv_to_file(CounterRecord* record, FILE* file) { //Columns are VP,task,ret_addr, (core,cycles,instrs)* for each savepoint, blocked,unblocked fprintf(file,"%d,%d,%p,",record->vp_id,record->task_position,record->addr_of_libcall_for_req); - fprintf(file,"%d,%lu,%lu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs); - fprintf(file,"%d,%lu,%lu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs); - fprintf(file,"%d,%lu,%lu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs); - fprintf(file,"%d,%lu,%lu,",record->work_core,record->start_work_cycles,record->start_work_instrs); - fprintf(file,"%d,%lu,%lu,",record->work_core,record->suspend_cycles,record->suspend_instrs); - fprintf(file,"%d,%lu,%lu,",record->req_core,record->req_cycles,record->req_instrs); + fprintf(file,"%d,%llu,%llu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs); + fprintf(file,"%d,%llu,%llu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs); + fprintf(file,"%d,%llu,%llu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs); + fprintf(file,"%d,%llu,%llu,",record->work_core,record->start_work_cycles,record->start_work_instrs); + fprintf(file,"%d,%llu,%llu,",record->work_core,record->suspend_cycles,record->suspend_instrs); + fprintf(file,"%d,%llu,%llu,",record->req_core,record->req_cycles,record->req_instrs); fprintf(file,"%u,%u\n",record->blocked_timestamp,record->unblocked_timestamp); } \ No newline at end of file diff -r ce02441b77cf -r 5475f90c248a MasterLoop.c --- a/MasterLoop.c Mon Aug 29 19:12:06 2011 +0200 +++ b/MasterLoop.c Wed Sep 07 13:26:30 2011 +0200 @@ -155,6 +155,10 @@ //End of task, start of next task //print counters from last run print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput); + + Dependency* newd = new_dependency(currSlot->procrAssignedToSlot->procrID,lastRecord->task_position,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position + 1); + addToDynArray((void*) newd ,masterEnv->dependenciesInfo); + //print_record_human_readable(lastRecord); //create new entry in record array CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); diff -r ce02441b77cf -r 5475f90c248a VMS.c --- a/VMS.c Mon Aug 29 19:12:06 2011 +0200 +++ b/VMS.c Wed Sep 07 13:26:30 2011 +0200 @@ -256,7 +256,7 @@ prctl(PR_TASK_PERF_EVENTS_ENABLE); uint64 tmpc,tmpi; saveCyclesAndInstrs(0,tmpc,tmpi); - printf("Start: cycles = %lu, instrs = %lu\n",tmpc,tmpi); + printf("Start: cycles = %llu, instrs = %llu\n",tmpc,tmpi); #endif //======================================================================== @@ -725,7 +725,7 @@ #ifdef MEAS__PERF_COUNTERS uint64 tmpc,tmpi; saveCyclesAndInstrs(0,tmpc,tmpi); - printf("End: cycles = %lu, instrs = %lu\n",tmpc,tmpi); + printf("End: cycles = %llu, instrs = %llu\n",tmpc,tmpi); prctl(PR_TASK_PERF_EVENTS_DISABLE); /* for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ ){ @@ -782,7 +782,7 @@ char filename[255]; for(n=0;n<255;n++) { - sprintf(filename, "./counters/Dependencies.%d.csv",n); + sprintf(filename, "./counters/Dependencies.%d.dot",n); output = fopen(filename,"r"); if(output) { @@ -791,13 +791,20 @@ break; } } + if(n<255){ 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"); + if(output!=NULL){ + set_dependency_file(output); + fprintf(output,"digraph Dependencies {\n"); + + forAllInDynArrayDo( _VMSMasterEnv->dependenciesInfo, &print_dependency_to_file ); + fprintf(output,"}\n"); + } else + printf("Opening Dependencies file failed. Please check that folder \"counters\" exists in run directory.\n"); + } else { + printf("Could not open Dependencies file, please clean \"counters\" folder. (Must contain less than 255 files.)\n"); + } #endif #ifdef MEAS__TIME_PLUGIN printHist( _VMSMasterEnv->reqHdlrLowTimeHist ); diff -r ce02441b77cf -r 5475f90c248a dependency.c --- a/dependency.c Mon Aug 29 19:12:06 2011 +0200 +++ b/dependency.c Wed Sep 07 13:26:30 2011 +0200 @@ -3,10 +3,12 @@ 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; + if (newDep!=NULL){ + newDep->from_vp = from_vp; + newDep->from_task = from_task; + newDep->to_vp = to_vp; + newDep->to_task = to_task; + } return newDep; } @@ -14,6 +16,7 @@ dependency_file = file; } -void print_dependency_to_file(Dependency* dep){ +void print_dependency_to_file(void* _dep){ + Dependency* dep = (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 ce02441b77cf -r 5475f90c248a dependency.h --- a/dependency.h Mon Aug 29 19:12:06 2011 +0200 +++ b/dependency.h Wed Sep 07 13:26:30 2011 +0200 @@ -26,7 +26,7 @@ int set_dependency_file(FILE* file); -void print_dependency_to_file(Dependency* dep); +void print_dependency_to_file(void* dep); #endif /* DEPENDENCY_H */