changeset 130:5475f90c248a perf_counters

fix outputs (dependency file creation, counter length)
author Nina Engelhardt
date Wed, 07 Sep 2011 13:26:30 +0200
parents ce02441b77cf
children 395f58384a5c
files Counters/Counters.c MasterLoop.c VMS.c dependency.c dependency.h
diffstat 5 files changed, 46 insertions(+), 32 deletions(-) [+]
line diff
     1.1 --- a/Counters/Counters.c	Mon Aug 29 19:12:06 2011 +0200
     1.2 +++ b/Counters/Counters.c	Wed Sep 07 13:26:30 2011 +0200
     1.3 @@ -4,25 +4,25 @@
     1.4  
     1.5  void print_record_human_readable(CounterRecord* record){
     1.6      printf("=== Loop Stats (VP %d # %d suspended at %p): ===\n",record->vp_id,record->task_position,record->addr_of_libcall_for_req);
     1.7 -    printf("Constraints check done:\t%lu cycles, %lu instrs [Core %d]\n",record->sc_done_cycles,record->sc_done_instrs,record->req_core);
     1.8 +    printf("Constraints check done:\t%llu cycles, %llu instrs [Core %d]\n",record->sc_done_cycles,record->sc_done_instrs,record->req_core);
     1.9      printf("Time in ready queue:\tblocked at %u, unblocked at %u\n",record->blocked_timestamp,record->unblocked_timestamp);
    1.10 -    printf("Assigner started:\t%lu cycles, %lu instrs [Core %d]\n",record->start_assign_cycles,record->start_assign_instrs,record->assigning_core);
    1.11 -    printf("Assigner ended:  \t%lu cycles, %lu instrs [Core %d]\n",record->end_assign_cycles,record->end_assign_instrs,record->assigning_core);
    1.12 -    printf("Work+comm started:\t%lu cycles, %lu instrs [Core %d]\n",record->start_work_cycles,record->start_work_instrs,record->work_core);
    1.13 -    printf("Work+comm ended:\t%lu cycles, %lu instrs [Core %d]\n",record->suspend_cycles,record->suspend_instrs,record->work_core);
    1.14 -    printf("Status request read:\t%lu cycles, %lu instrs [Core %d]\n",record->req_cycles,record->req_instrs,record->req_core);  
    1.15 +    printf("Assigner started:\t%llu cycles, %llu instrs [Core %d]\n",record->start_assign_cycles,record->start_assign_instrs,record->assigning_core);
    1.16 +    printf("Assigner ended:  \t%llu cycles, %llu instrs [Core %d]\n",record->end_assign_cycles,record->end_assign_instrs,record->assigning_core);
    1.17 +    printf("Work+comm started:\t%llu cycles, %llu instrs [Core %d]\n",record->start_work_cycles,record->start_work_instrs,record->work_core);
    1.18 +    printf("Work+comm ended:\t%llu cycles, %llu instrs [Core %d]\n",record->suspend_cycles,record->suspend_instrs,record->work_core);
    1.19 +    printf("Status request read:\t%llu cycles, %llu instrs [Core %d]\n",record->req_cycles,record->req_instrs,record->req_core);  
    1.20      fflush(stdin);
    1.21  }
    1.22      
    1.23  void print_record_csv(CounterRecord* record) {
    1.24      //Columns are VP,task,ret_addr, (core,cycles,instrs)* for each savepoint, blocked,unblocked
    1.25      printf("%d,%d,%p,",record->vp_id,record->task_position,record->addr_of_libcall_for_req);
    1.26 -    printf("%d,%lu,%lu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs);
    1.27 -    printf("%d,%lu,%lu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs);
    1.28 -    printf("%d,%lu,%lu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs);
    1.29 -    printf("%d,%lu,%lu,",record->work_core,record->start_work_cycles,record->start_work_instrs);
    1.30 -    printf("%d,%lu,%lu,",record->work_core,record->suspend_cycles,record->suspend_instrs);
    1.31 -    printf("%d,%lu,%lu,",record->req_core,record->req_cycles,record->req_instrs); 
    1.32 +    printf("%d,%llu,%llu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs);
    1.33 +    printf("%d,%llu,%llu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs);
    1.34 +    printf("%d,%llu,%llu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs);
    1.35 +    printf("%d,%llu,%llu,",record->work_core,record->start_work_cycles,record->start_work_instrs);
    1.36 +    printf("%d,%llu,%llu,",record->work_core,record->suspend_cycles,record->suspend_instrs);
    1.37 +    printf("%d,%llu,%llu,",record->req_core,record->req_cycles,record->req_instrs); 
    1.38      printf("%u,%u\n",record->blocked_timestamp,record->unblocked_timestamp);
    1.39      fflush(stdin);
    1.40  }
    1.41 @@ -30,11 +30,11 @@
    1.42  void print_record_csv_to_file(CounterRecord* record, FILE* file) {
    1.43      //Columns are VP,task,ret_addr, (core,cycles,instrs)* for each savepoint, blocked,unblocked
    1.44      fprintf(file,"%d,%d,%p,",record->vp_id,record->task_position,record->addr_of_libcall_for_req);
    1.45 -    fprintf(file,"%d,%lu,%lu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs);
    1.46 -    fprintf(file,"%d,%lu,%lu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs);
    1.47 -    fprintf(file,"%d,%lu,%lu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs);
    1.48 -    fprintf(file,"%d,%lu,%lu,",record->work_core,record->start_work_cycles,record->start_work_instrs);
    1.49 -    fprintf(file,"%d,%lu,%lu,",record->work_core,record->suspend_cycles,record->suspend_instrs);
    1.50 -    fprintf(file,"%d,%lu,%lu,",record->req_core,record->req_cycles,record->req_instrs); 
    1.51 +    fprintf(file,"%d,%llu,%llu,",record->req_core,record->sc_done_cycles,record->sc_done_instrs);
    1.52 +    fprintf(file,"%d,%llu,%llu,",record->assigning_core,record->start_assign_cycles,record->start_assign_instrs);
    1.53 +    fprintf(file,"%d,%llu,%llu,",record->assigning_core,record->end_assign_cycles,record->end_assign_instrs);
    1.54 +    fprintf(file,"%d,%llu,%llu,",record->work_core,record->start_work_cycles,record->start_work_instrs);
    1.55 +    fprintf(file,"%d,%llu,%llu,",record->work_core,record->suspend_cycles,record->suspend_instrs);
    1.56 +    fprintf(file,"%d,%llu,%llu,",record->req_core,record->req_cycles,record->req_instrs); 
    1.57      fprintf(file,"%u,%u\n",record->blocked_timestamp,record->unblocked_timestamp);
    1.58  }
    1.59 \ No newline at end of file
     2.1 --- a/MasterLoop.c	Mon Aug 29 19:12:06 2011 +0200
     2.2 +++ b/MasterLoop.c	Wed Sep 07 13:26:30 2011 +0200
     2.3 @@ -155,6 +155,10 @@
     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 +               
     2.8 +               Dependency* newd = new_dependency(currSlot->procrAssignedToSlot->procrID,lastRecord->task_position,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position + 1);
     2.9 +               addToDynArray((void*) newd ,masterEnv->dependenciesInfo);     
    2.10 +              
    2.11                 //print_record_human_readable(lastRecord);
    2.12                 //create new entry in record array
    2.13                 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord));
     3.1 --- a/VMS.c	Mon Aug 29 19:12:06 2011 +0200
     3.2 +++ b/VMS.c	Wed Sep 07 13:26:30 2011 +0200
     3.3 @@ -256,7 +256,7 @@
     3.4     prctl(PR_TASK_PERF_EVENTS_ENABLE);
     3.5     uint64 tmpc,tmpi;
     3.6     saveCyclesAndInstrs(0,tmpc,tmpi);
     3.7 -   printf("Start: cycles = %lu, instrs = %lu\n",tmpc,tmpi);
     3.8 +   printf("Start: cycles = %llu, instrs = %llu\n",tmpc,tmpi);
     3.9     #endif
    3.10     
    3.11     //========================================================================
    3.12 @@ -725,7 +725,7 @@
    3.13  #ifdef MEAS__PERF_COUNTERS 
    3.14     uint64 tmpc,tmpi;
    3.15     saveCyclesAndInstrs(0,tmpc,tmpi);
    3.16 -   printf("End: cycles = %lu, instrs = %lu\n",tmpc,tmpi);
    3.17 +   printf("End: cycles = %llu, instrs = %llu\n",tmpc,tmpi);
    3.18     prctl(PR_TASK_PERF_EVENTS_DISABLE);
    3.19  /*
    3.20     for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ ){
    3.21 @@ -782,7 +782,7 @@
    3.22     char filename[255];    
    3.23      for(n=0;n<255;n++)
    3.24      {
    3.25 -        sprintf(filename, "./counters/Dependencies.%d.csv",n);
    3.26 +        sprintf(filename, "./counters/Dependencies.%d.dot",n);
    3.27          output = fopen(filename,"r");
    3.28          if(output)
    3.29          {
    3.30 @@ -791,13 +791,20 @@
    3.31              break;
    3.32          }
    3.33      }
    3.34 +   if(n<255){
    3.35      printf("Saving Dependencies to File: %s ...\n", filename);
    3.36      output = fopen(filename,"w+");
    3.37 -    set_dependency_file(output);
    3.38 -    fprintf(output,"digraph Dependencies {\n");
    3.39 -    
    3.40 -    forAllInDynArrayDo( _VMSMasterEnv->dependenciesInfo, &print_dependency_to_file );
    3.41 -    fprintf(output,"}\n");
    3.42 +    if(output!=NULL){
    3.43 +        set_dependency_file(output);
    3.44 +        fprintf(output,"digraph Dependencies {\n");
    3.45 +        
    3.46 +        forAllInDynArrayDo( _VMSMasterEnv->dependenciesInfo, &print_dependency_to_file );
    3.47 +        fprintf(output,"}\n");
    3.48 +    } else
    3.49 +        printf("Opening Dependencies file failed. Please check that folder \"counters\" exists in run directory.\n");
    3.50 +   } else {
    3.51 +       printf("Could not open Dependencies file, please clean \"counters\" folder. (Must contain less than 255 files.)\n");
    3.52 +   }
    3.53  #endif
    3.54     #ifdef MEAS__TIME_PLUGIN
    3.55     printHist( _VMSMasterEnv->reqHdlrLowTimeHist );
     4.1 --- a/dependency.c	Mon Aug 29 19:12:06 2011 +0200
     4.2 +++ b/dependency.c	Wed Sep 07 13:26:30 2011 +0200
     4.3 @@ -3,10 +3,12 @@
     4.4  
     4.5  Dependency* new_dependency(int from_vp, int from_task, int to_vp, int to_task){
     4.6      Dependency* newDep = (Dependency*) VMS__malloc(sizeof(Dependency));
     4.7 -    newDep->from_vp = from_vp;
     4.8 -    newDep->from_task = from_task;
     4.9 -    newDep->to_vp = to_vp;
    4.10 -    newDep->to_task = to_task;
    4.11 +    if (newDep!=NULL){
    4.12 +        newDep->from_vp = from_vp;
    4.13 +        newDep->from_task = from_task;
    4.14 +        newDep->to_vp = to_vp;
    4.15 +        newDep->to_task = to_task;
    4.16 +    }
    4.17      return newDep;
    4.18  }
    4.19  
    4.20 @@ -14,6 +16,7 @@
    4.21      dependency_file = file;
    4.22  }
    4.23  
    4.24 -void print_dependency_to_file(Dependency* dep){
    4.25 +void print_dependency_to_file(void* _dep){
    4.26 +    Dependency* dep = (Dependency*) _dep;
    4.27      fprintf(dependency_file,"VP_%d_%d -> VP_%d_%d;\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
    4.28  }
     5.1 --- a/dependency.h	Mon Aug 29 19:12:06 2011 +0200
     5.2 +++ b/dependency.h	Wed Sep 07 13:26:30 2011 +0200
     5.3 @@ -26,7 +26,7 @@
     5.4  
     5.5  int set_dependency_file(FILE* file);
     5.6  
     5.7 -void print_dependency_to_file(Dependency* dep);
     5.8 +void print_dependency_to_file(void* dep);
     5.9  
    5.10  #endif	/* DEPENDENCY_H */
    5.11