changeset 131:395f58384a5c perf_counters

dot output
author Nina Engelhardt
date Thu, 15 Sep 2011 17:31:33 +0200
parents 5475f90c248a
children 6b629059c7ab d7c0c0a8187a
files Counters/Counters.c Counters/Counters.h MasterLoop.c VMS.c VMS.h
diffstat 5 files changed, 36 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/Counters/Counters.c	Wed Sep 07 13:26:30 2011 +0200
     1.2 +++ b/Counters/Counters.c	Thu Sep 15 17:31:33 2011 +0200
     1.3 @@ -36,5 +36,21 @@
     1.4      fprintf(file,"%d,%llu,%llu,",record->work_core,record->start_work_cycles,record->start_work_instrs);
     1.5      fprintf(file,"%d,%llu,%llu,",record->work_core,record->suspend_cycles,record->suspend_instrs);
     1.6      fprintf(file,"%d,%llu,%llu,",record->req_core,record->req_cycles,record->req_instrs); 
     1.7 +    fprintf(file,"%d,%llu,%llu,",record->req_core,record->next_task_req_cycles,record->next_task_req_instrs);   
     1.8      fprintf(file,"%u,%u\n",record->blocked_timestamp,record->unblocked_timestamp);
     1.9 +}
    1.10 +
    1.11 +void set_dot_file(FILE* file){
    1.12 +    dot_file = file;
    1.13 +}
    1.14 +
    1.15 +void print_dot_node_info(void* _record){
    1.16 +    CounterRecord* record = (CounterRecord*) _record;
    1.17 +    fprintf(dot_file,"VP_%d_%d [shape=record,label=\"{ VP %d # %d ",record->vp_id,record->task_position,record->vp_id,record->task_position);
    1.18 +    fprintf(dot_file,"| { sc_ch | C:%lld I:%lld }",record->sc_done_cycles - record->req_cycles,record->sc_done_instrs - record->req_instrs);
    1.19 +    fprintf(dot_file,"| { sync | C:%d }", record->task_position ? record->unblocked_timestamp - record->blocked_timestamp : 0);
    1.20 +    fprintf(dot_file,"| { assign | C:%lld I:%lld }",record->end_assign_cycles - record->start_assign_cycles,record->end_assign_instrs - record->start_assign_instrs);
    1.21 +    fprintf(dot_file,"| { W + C | C:%lld I:%lld }",record->suspend_cycles - record->start_work_cycles,record->suspend_instrs - record->start_work_instrs);
    1.22 +    fprintf(dot_file,"| { status | C:%lld I:%lld }",record->next_task_req_cycles - record->suspend_cycles,record->next_task_req_instrs - record->suspend_instrs);
    1.23 +    fprintf(dot_file,"}\"];\n");
    1.24  }
    1.25 \ No newline at end of file
     2.1 --- a/Counters/Counters.h	Wed Sep 07 13:26:30 2011 +0200
     2.2 +++ b/Counters/Counters.h	Thu Sep 15 17:31:33 2011 +0200
     2.3 @@ -35,14 +35,22 @@
     2.4      uint64 start_work_instrs;
     2.5      uint64 suspend_cycles;
     2.6      uint64 suspend_instrs;
     2.7 +    uint64 next_task_req_cycles;
     2.8 +    uint64 next_task_req_instrs;
     2.9      void* addr_of_libcall_for_req;
    2.10  } CounterRecord;
    2.11  
    2.12 +FILE* dot_file;
    2.13 +
    2.14  void print_record_human_readable(CounterRecord* record);
    2.15  
    2.16  void print_record_csv(CounterRecord* record);
    2.17  
    2.18  void print_record_csv_to_file(CounterRecord* record, FILE* file);
    2.19  
    2.20 +void set_dot_file(FILE* file);
    2.21 +
    2.22 +void print_dot_node_info(void* counterRecord);
    2.23 +
    2.24  #endif	/* COUNTERS_H */
    2.25  
     3.1 --- a/MasterLoop.c	Wed Sep 07 13:26:30 2011 +0200
     3.2 +++ b/MasterLoop.c	Thu Sep 15 17:31:33 2011 +0200
     3.3 @@ -151,9 +151,10 @@
     3.4                 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
     3.5                 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
     3.6                 lastRecord->req_core = thisCoresIdx;
     3.7 -               saveCyclesAndInstrs(thisCoresIdx,lastRecord->req_cycles,lastRecord->req_instrs);
     3.8 +               saveCyclesAndInstrs(thisCoresIdx,lastRecord->next_task_req_cycles,lastRecord->next_task_req_instrs);
     3.9                 //End of task, start of next task
    3.10                 //print counters from last run
    3.11 +               addToDynArray((void*)lastRecord,masterEnv->counter_history_array_info);
    3.12                 print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput);
    3.13                 
    3.14                 Dependency* newd = new_dependency(currSlot->procrAssignedToSlot->procrID,lastRecord->task_position,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position + 1);
    3.15 @@ -165,6 +166,8 @@
    3.16                 newRecord->req_core = thisCoresIdx;
    3.17                 newRecord->vp_id = currSlot->procrAssignedToSlot->procrID;
    3.18                 newRecord->task_position = lastRecord->task_position + 1;
    3.19 +               newRecord->req_cycles = lastRecord->next_task_req_cycles;
    3.20 +               newRecord->req_instrs = lastRecord->next_task_req_instrs;
    3.21                 getReturnAddressBeforeLibraryCall(currSlot->procrAssignedToSlot, &(newRecord->addr_of_libcall_for_req));
    3.22                 addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info);
    3.23                 lastRecord = newRecord;
     4.1 --- a/VMS.c	Wed Sep 07 13:26:30 2011 +0200
     4.2 +++ b/VMS.c	Thu Sep 15 17:31:33 2011 +0200
     4.3 @@ -192,6 +192,8 @@
     4.4     #endif
     4.5     
     4.6     #ifdef MEAS__PERF_COUNTERS
     4.7 +   _VMSMasterEnv->counter_history = VMS__malloc(10*sizeof(void*));
     4.8 +   _VMSMasterEnv->counter_history_array_info = makePrivDynArrayInfoFrom((void***)&(_VMSMasterEnv->counter_history),10);
     4.9     //printf("Creating HW counters...");
    4.10     FILE* output;
    4.11     int n;
    4.12 @@ -797,7 +799,8 @@
    4.13      if(output!=NULL){
    4.14          set_dependency_file(output);
    4.15          fprintf(output,"digraph Dependencies {\n");
    4.16 -        
    4.17 +        set_dot_file(output);
    4.18 +        forAllInDynArrayDo(_VMSMasterEnv->counter_history_array_info, &print_dot_node_info );
    4.19          forAllInDynArrayDo( _VMSMasterEnv->dependenciesInfo, &print_dependency_to_file );
    4.20          fprintf(output,"}\n");
    4.21      } else
     5.1 --- a/VMS.h	Wed Sep 07 13:26:30 2011 +0200
     5.2 +++ b/VMS.h	Thu Sep 15 17:31:33 2011 +0200
     5.3 @@ -276,6 +276,10 @@
     5.4     Dependency** dependencies;
     5.5     PrivDynArrayInfo* dependenciesInfo;
     5.6     #endif
     5.7 +   #ifdef MEAS__PERF_COUNTERS //
     5.8 +   CounterRecord** counter_history;
     5.9 +   PrivDynArrayInfo* counter_history_array_info;
    5.10 +   #endif
    5.11   }
    5.12  MasterEnv;
    5.13