changeset 50:5c59bfe62d92 perf_counters

handler interface for counters... not working
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Fri, 13 Jan 2012 15:03:20 +0100
parents 70d24e2343bb
children 323418163771
files SSR.h SSR_Counter_Recording.c SSR_Counter_Recording.h SSR_PluginFns.c SSR_lib.c
diffstat 5 files changed, 63 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/SSR.h	Wed Jan 04 16:39:35 2012 +0100
     1.2 +++ b/SSR.h	Fri Jan 13 15:03:20 2012 +0100
     1.3 @@ -115,7 +115,10 @@
     1.4     Unit last_in_slot[NUM_CORES * NUM_SCHED_SLOTS];
     1.5     ListOfArrays* hwArcs;
     1.6     #endif
     1.7 -   
     1.8 +
     1.9 +   #ifdef MEAS__PERF_COUNTERS
    1.10 +   ListOfArrays* counterList;
    1.11 +   #endif
    1.12   }
    1.13  SSRSemEnv;
    1.14  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/SSR_Counter_Recording.c	Fri Jan 13 15:03:20 2012 +0100
     2.3 @@ -0,0 +1,24 @@
     2.4 +#include "SSR_Counter_Recording.h"
     2.5 +#include "VMS/VMS.h"
     2.6 +#include "SSR.h"
     2.7 +
     2.8 +void SSR__init_counter_data_structs(){
     2.9 +    SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv;
    2.10 +    semanticEnv->counterList = makeListOfArrays(sizeof(CounterEvent), 128);
    2.11 +}
    2.12 +
    2.13 +void SSR__counter_handler(int evt_type, int coreID, int slotID, VirtProcr* pr, uint64 cycles, uint64 instrs)
    2.14 +{
    2.15 +/*
    2.16 +    SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv;
    2.17 +            
    2.18 +    CounterEvent e;
    2.19 +    e.event_type = evt_type;
    2.20 +    e.coreID = coreID;
    2.21 +    e.slotID = slotID;
    2.22 +    e.cycles = cycles;
    2.23 +    e.instrs = instrs;
    2.24 +    
    2.25 +    addToListOfArrays(CounterEvent,e,semanticEnv->counterList);
    2.26 +*/
    2.27 +}
    2.28 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/SSR_Counter_Recording.h	Fri Jan 13 15:03:20 2012 +0100
     3.3 @@ -0,0 +1,26 @@
     3.4 +/* 
     3.5 + * File:   SSR_Counter_Recording.h
     3.6 + * Author: nengel
     3.7 + *
     3.8 + * Created on January 11, 2012, 3:03 PM
     3.9 + */
    3.10 +
    3.11 +#ifndef SSR_COUNTER_RECORDING_H
    3.12 +#define	SSR_COUNTER_RECORDING_H
    3.13 +
    3.14 +#include "VMS/VMS.h"
    3.15 +
    3.16 +typedef struct {
    3.17 +   int event_type;
    3.18 +   int coreID;
    3.19 +   int slotID;
    3.20 +   uint64 cycles;
    3.21 +   uint64 instrs;
    3.22 +} CounterEvent;
    3.23 +
    3.24 +void SSR__init_counter_data_structs();
    3.25 +
    3.26 +void SSR__counter_handler(int evt_type, int coreID, int slotID, VirtProcr* pr, uint64 cycles, uint64 instrs);
    3.27 +
    3.28 +#endif	/* SSR_COUNTER_RECORDING_H */
    3.29 +
     4.1 --- a/SSR_PluginFns.c	Wed Jan 04 16:39:35 2012 +0100
     4.2 +++ b/SSR_PluginFns.c	Fri Jan 13 15:03:20 2012 +0100
     4.3 @@ -249,9 +249,11 @@
     4.4  resume_procr( VirtProcr *procr, SSRSemEnv *semEnv )
     4.5   {
     4.6     #ifdef MEAS__PERF_COUNTERS
     4.7 +/*
     4.8     int lastRecordIdx = procr->counter_history_array_info->numInArray -1;
     4.9     CounterRecord* lastRecord = procr->counter_history[lastRecordIdx];
    4.10     saveLowTimeStampCountInto(lastRecord->unblocked_timestamp);
    4.11 +*/
    4.12     #endif
    4.13     #ifdef OBSERVE_UCC
    4.14     Unit newu;
     5.1 --- a/SSR_lib.c	Wed Jan 04 16:39:35 2012 +0100
     5.2 +++ b/SSR_lib.c	Fri Jan 13 15:03:20 2012 +0100
     5.3 @@ -13,7 +13,7 @@
     5.4  #include "VMS/Queue_impl/PrivateQueue.h"
     5.5  #include "VMS/Hash_impl/PrivateHash.h"
     5.6  #include "SSR.h"
     5.7 -
     5.8 +#include "SSR_Counter_Recording.h"
     5.9  
    5.10  //==========================================================================
    5.11  
    5.12 @@ -203,12 +203,18 @@
    5.13        //Hook up the semantic layer's plug-ins to the Master virt procr
    5.14     _VMSMasterEnv->requestHandler = &SSR__Request_Handler;
    5.15     _VMSMasterEnv->slaveScheduler = &SSR__schedule_virt_procr;
    5.16 +   #ifdef MEAS__PERF_COUNTERS
    5.17 +   _VMSMasterEnv->counterHandler = &SSR__counter_handler;
    5.18 +   #endif
    5.19  
    5.20        //create the semantic layer's environment (all its data) and add to
    5.21        // the master environment
    5.22     semanticEnv = VMS__malloc( sizeof( SSRSemEnv ) );
    5.23     _VMSMasterEnv->semanticEnv = semanticEnv;
    5.24     
    5.25 +   #ifdef MEAS__PERF_COUNTERS
    5.26 +   SSR__init_counter_data_structs();
    5.27 +   #endif
    5.28     #ifdef OBSERVE_UCC
    5.29     semanticEnv->unitList = makeListOfArrays(sizeof(Unit),128);
    5.30     semanticEnv->ctlDependenciesList = makeListOfArrays(sizeof(Dependency),128);