changeset 167:981acd1db6af perf_counters

Separate UCC recording from VMS core and put it into SSR plugin
author Nina Engelhardt
date Mon, 05 Dec 2011 18:59:48 +0100
parents aefd87f9d12f
children 3bd35fc83c61
files Counters/run_graph.py MasterLoop.c ProcrContext.c VMS.c VMS.h dependency.c dependency.h
diffstat 7 files changed, 10 insertions(+), 101 deletions(-) [+]
line diff
     1.1 --- a/Counters/run_graph.py	Tue Oct 18 15:53:04 2011 +0200
     1.2 +++ b/Counters/run_graph.py	Mon Dec 05 18:59:48 2011 +0100
     1.3 @@ -17,7 +17,7 @@
     1.4  try:
     1.5  	counterfile = open(sys.argv[2])
     1.6  except IOError as (errno, strerror):
     1.7 -	print "Error {0}: {1}".format(errno, strerror)
     1.8 +	print (("Error {0}: {1}".format)(errno, strerror))
     1.9  	sys.exit()	
    1.10  	
    1.11  from pygraph.readwrite.dot import read,write
    1.12 @@ -26,7 +26,7 @@
    1.13  
    1.14  import csv
    1.15  
    1.16 -counterreader = csv.reader(counterfile)
    1.17 +counterreader = (csv.reader)(counterfile)
    1.18  
    1.19  
    1.20  
     2.1 --- a/MasterLoop.c	Tue Oct 18 15:53:04 2011 +0200
     2.2 +++ b/MasterLoop.c	Mon Dec 05 18:59:48 2011 +0100
     2.3 @@ -167,8 +167,7 @@
     2.4                 addToDynArray((void*)lastRecord,masterEnv->counter_history_array_info);
     2.5                 print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput);
     2.6                 
     2.7 -               Dependency* newd = new_dependency(currSlot->procrAssignedToSlot->procrID,lastRecord->task_position,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position + 1);
     2.8 -               addToDynArray((void*) newd ,masterEnv->dependenciesInfo);     
     2.9 +  
    2.10                
    2.11  
    2.12                 
    2.13 @@ -217,6 +216,7 @@
    2.14              schedVirtPr->schedSlot        = currSlot;
    2.15              currSlot->needsProcrAssigned  = FALSE;
    2.16              numSlotsFilled               += 1;
    2.17 +            schedVirtPr->numTimesScheduled++;
    2.18                 #ifdef MEAS__PERF_COUNTERS
    2.19                 //end assigner
    2.20                 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
     3.1 --- a/ProcrContext.c	Tue Oct 18 15:53:04 2011 +0200
     3.2 +++ b/ProcrContext.c	Mon Dec 05 18:59:48 2011 +0100
     3.3 @@ -23,6 +23,7 @@
     3.4  
     3.5     newPr->startOfStack = stackLocs;
     3.6     newPr->procrID      = _VMSMasterEnv->numProcrsCreated++;
     3.7 +   newPr->numTimesScheduled = 0;
     3.8     newPr->initialData  = initialData;
     3.9     newPr->requests     = NULL;
    3.10     newPr->schedSlot    = NULL;
     4.1 --- a/VMS.c	Tue Oct 18 15:53:04 2011 +0200
     4.2 +++ b/VMS.c	Mon Dec 05 18:59:48 2011 +0100
     4.3 @@ -186,10 +186,6 @@
     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 DETECT_LOOP_GRAPH
    4.13     _VMSMasterEnv->loop_graph = VMS__malloc(10*sizeof(void*));
    4.14 @@ -245,7 +241,7 @@
    4.15         	hw_event.config = 0x0000000000000000; //cycles
    4.16          _VMSMasterEnv->cycles_counter_fd[coreIdx] = syscall(__NR_perf_event_open, &hw_event,
    4.17   		0,//pid_t pid, 
    4.18 -		-1,//int cpu, 
    4.19 +		coreIdx,//int cpu, 
    4.20  		-1,//int group_fd,
    4.21  		0//unsigned long flags
    4.22  	);
    4.23 @@ -256,7 +252,7 @@
    4.24          hw_event.config = 0x0000000000000001; //instrs
    4.25          _VMSMasterEnv->instrs_counter_fd[coreIdx] = syscall(__NR_perf_event_open, &hw_event,
    4.26   		0,//pid_t pid, 
    4.27 -		-1,//int cpu, 
    4.28 +		coreIdx,//int cpu, 
    4.29  		-1,//int group_fd,
    4.30  		0//unsigned long flags
    4.31  	);
    4.32 @@ -788,37 +784,7 @@
    4.33     //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&printHist );
    4.34     //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&saveHistToFile);
    4.35     //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &freeHistExt );
    4.36 -#ifdef DETECT_DEPENDENCIES
    4.37 -   FILE* output;
    4.38 -   int n;
    4.39 -   char filename[255];    
    4.40 -    for(n=0;n<255;n++)
    4.41 -    {
    4.42 -        sprintf(filename, "./counters/Dependencies.%d.dot",n);
    4.43 -        output = fopen(filename,"r");
    4.44 -        if(output)
    4.45 -        {
    4.46 -            fclose(output);
    4.47 -        }else{
    4.48 -            break;
    4.49 -        }
    4.50 -    }
    4.51 -   if(n<255){
    4.52 -    printf("Saving Dependencies to File: %s ...\n", filename);
    4.53 -    output = fopen(filename,"w+");
    4.54 -    if(output!=NULL){
    4.55 -        set_dependency_file(output);
    4.56 -        fprintf(output,"digraph Dependencies {\n");
    4.57 -        set_dot_file(output);
    4.58 -        forAllInDynArrayDo(_VMSMasterEnv->counter_history_array_info, &print_dot_node_info );
    4.59 -        forAllInDynArrayDo( _VMSMasterEnv->dependenciesInfo, &print_dependency_to_file );
    4.60 -        fprintf(output,"}\n");
    4.61 -    } else
    4.62 -        printf("Opening Dependencies file failed. Please check that folder \"counters\" exists in run directory.\n");
    4.63 -   } else {
    4.64 -       printf("Could not open Dependencies file, please clean \"counters\" folder. (Must contain less than 255 files.)\n");
    4.65 -   }
    4.66 -#endif
    4.67 +
    4.68     #ifdef DETECT_LOOP_GRAPH
    4.69     FILE* loop_output;
    4.70     int loop_n;
     5.1 --- a/VMS.h	Tue Oct 18 15:53:04 2011 +0200
     5.2 +++ b/VMS.h	Mon Dec 05 18:59:48 2011 +0100
     5.3 @@ -17,7 +17,6 @@
     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  #include "loop.h"
     5.9  
    5.10  #include <pthread.h>
    5.11 @@ -77,7 +76,7 @@
    5.12  //#define NUM_TSC_ROUND_TRIPS 10
    5.13  
    5.14  #define MEAS__PERF_COUNTERS
    5.15 -#define DETECT_DEPENDENCIES
    5.16 +#define OBSERVE_UCC
    5.17  #define DETECT_LOOP_GRAPH
    5.18  
    5.19  //=========================  Hardware related Constants =====================
    5.20 @@ -216,6 +215,7 @@
    5.21        //========================================
    5.22     
    5.23     float64      createPtInSecs;  //have space but don't use on some configs
    5.24 +   int numTimesScheduled; //defines units together w/ procrID
    5.25   };
    5.26  //VirtProcr
    5.27  
    5.28 @@ -274,10 +274,6 @@
    5.29     int instrs_counter_fd[NUM_CORES];
    5.30     FILE* counteroutput;
    5.31     #endif
    5.32 -   #ifdef DETECT_DEPENDENCIES
    5.33 -   Dependency** dependencies;
    5.34 -   PrivDynArrayInfo* dependenciesInfo;
    5.35 -   #endif
    5.36     #ifdef MEAS__PERF_COUNTERS //
    5.37     CounterRecord** counter_history;
    5.38     PrivDynArrayInfo* counter_history_array_info;
     6.1 --- a/dependency.c	Tue Oct 18 15:53:04 2011 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,22 +0,0 @@
     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 -    if (newDep!=NULL){
    6.10 -        newDep->from_vp = from_vp;
    6.11 -        newDep->from_task = from_task;
    6.12 -        newDep->to_vp = to_vp;
    6.13 -        newDep->to_task = to_task;
    6.14 -    }
    6.15 -    return newDep;
    6.16 -}
    6.17 -
    6.18 -int set_dependency_file(FILE* file){
    6.19 -    dependency_file = file;
    6.20 -}
    6.21 -
    6.22 -void print_dependency_to_file(void* _dep){
    6.23 -    Dependency* dep = (Dependency*) _dep;
    6.24 -    fprintf(dependency_file,"VP_%d_%d -> VP_%d_%d;\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
    6.25 -}
     7.1 --- a/dependency.h	Tue Oct 18 15:53:04 2011 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,32 +0,0 @@
     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(void* dep);
    7.33 -
    7.34 -#endif	/* DEPENDENCY_H */
    7.35 -