changeset 279:6fcf6aa5c082 Common_Ancestor

define switch between sys malloc and vms malloc
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Wed, 27 Mar 2013 18:06:37 +0100
parents a6005210f581
children 67b684afa736
files CoreController.c HW_Dependent_Primitives/VMS__HW_measurement.c HW_Dependent_Primitives/VMS__HW_measurement.h Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Services_Offered_by_VMS/Memory_Handling/vmalloc.c
diffstat 5 files changed, 42 insertions(+), 29 deletions(-) [+]
line diff
     1.1 --- a/CoreController.c	Wed Mar 06 14:32:23 2013 +0100
     1.2 +++ b/CoreController.c	Wed Mar 27 18:06:37 2013 +0100
     1.3 @@ -144,13 +144,18 @@
     1.4        if( currSlotIdx >= NUM_ANIM_SLOTS ) goto switchToMaster;
     1.5        currSlot = animSlots[ currSlotIdx ];
     1.6  
     1.7 -      if( ! currSlot->needsSlaveAssigned ) //slot does have slave assigned
     1.8 -      { if(currSlot->slaveAssignedToSlot->typeOfVP == Idle){
     1.9 -          numRepetitionsWithNoWork ++;
    1.10 -        } else {
    1.11 -          numRepetitionsWithNoWork = 0;     //reset back2back master count
    1.12 -        }
    1.13 -         currSlotIdx ++;
    1.14 +        if (!currSlot->needsSlaveAssigned) //slot does have slave assigned
    1.15 +        {
    1.16 +#ifdef IDLE_SLAVES
    1.17 +            if (currSlot->slaveAssignedToSlot->typeOfVP == Idle) {
    1.18 +                numRepetitionsWithNoWork++;
    1.19 +            } else {
    1.20 +                numRepetitionsWithNoWork = 0; //reset back2back master count
    1.21 +            }
    1.22 +#else
    1.23 +            numRepetitionsWithNoWork = 0;
    1.24 +#endif
    1.25 +            currSlotIdx++;
    1.26           currVP = currSlot->slaveAssignedToSlot;
    1.27           HOLISTIC__Record_last_work;
    1.28         }
     2.1 --- a/HW_Dependent_Primitives/VMS__HW_measurement.c	Wed Mar 06 14:32:23 2013 +0100
     2.2 +++ b/HW_Dependent_Primitives/VMS__HW_measurement.c	Wed Mar 27 18:06:37 2013 +0100
     2.3 @@ -19,7 +19,7 @@
     2.4  	hw_event.pinned = 1; /* must always be on PMU */
     2.5  	hw_event.exclusive = 0; /* only group on PMU     */
     2.6  	hw_event.exclude_user = 0; /* don't count user      */
     2.7 -	hw_event.exclude_kernel = 0; /* ditto kernel          */
     2.8 +	hw_event.exclude_kernel = 1; /* ditto kernel          */
     2.9  	hw_event.exclude_hv = 0; /* ditto hypervisor      */
    2.10  	hw_event.exclude_idle = 0; /* don't count when idle */
    2.11  
     3.1 --- a/HW_Dependent_Primitives/VMS__HW_measurement.h	Wed Mar 06 14:32:23 2013 +0100
     3.2 +++ b/HW_Dependent_Primitives/VMS__HW_measurement.h	Wed Mar 27 18:06:37 2013 +0100
     3.3 @@ -60,6 +60,6 @@
     3.4  //#define NUM_TSC_ROUND_TRIPS 10
     3.5  
     3.6  void setup_perf_counters();
     3.7 -uint64_t rdtsc(void);
     3.8 +//uint64_t rdtsc(void);
     3.9  #endif	/* */
    3.10  
     4.1 --- a/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h	Wed Mar 06 14:32:23 2013 +0100
     4.2 +++ b/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h	Wed Mar 27 18:06:37 2013 +0100
     4.3 @@ -81,12 +81,12 @@
     4.4  
     4.5     #define MEAS__Insert_Master_Meas_Fields_into_MasterEnv \
     4.6         Histogram       *masterLowTimeHist; \
     4.7 -       Histogram       *masterHighTimeHist;
     4.8 +       //Histogram       *masterHighTimeHist;
     4.9  
    4.10     #define MEAS__Make_Meas_Hists_for_Master_Meas \
    4.11        _VMSMasterEnv->masterLowTimeHist  = makeFixedBinHistExt( 100, 0, 200,\
    4.12                                                      "master_low_time_hist");\
    4.13 -      _VMSMasterEnv->masterHighTimeHist  = makeFixedBinHistExt( 100, 0, 200,\
    4.14 +     // _VMSMasterEnv->masterHighTimeHist  = makeFixedBinHistExt( 100, 0, 200,\
    4.15                                                      "master_high_time_hist");
    4.16  
    4.17        //Total Master time includes one coreloop time -- just assume the core
    4.18 @@ -97,14 +97,17 @@
    4.19  
    4.20     #define MEAS__Capture_Post_Master_Point \
    4.21        saveLowTimeStampCountInto( masterVP->endMasterTSCLow );\
    4.22 -      addIntervalToHist( startMasterTSCLow, endMasterTSCLow,\
    4.23 +      addIntervalToHist( masterVP->startMasterTSCLow, masterVP->endMasterTSCLow,\
    4.24                           _VMSMasterEnv->masterLowTimeHist ); \
    4.25 -      addIntervalToHist( startMasterTSCLow, endMasterTSCLow,\
    4.26 +      //addIntervalToHist( masterVP->startMasterTSCLow, masterVP->endMasterTSCLow,\
    4.27                           _VMSMasterEnv->masterHighTimeHist );
    4.28  
    4.29     #define MEAS__Print_Hists_for_Master_Meas \
    4.30 -      printHist( _VMSMasterEnv->pluginTimeHist );
    4.31 -
    4.32 +      printHist( _VMSMasterEnv->masterLowTimeHist ); \
    4.33 +      saveHistToFile( _VMSMasterEnv->masterLowTimeHist ); \
    4.34 +      //printHist( _VMSMasterEnv->masterHighTimeHist ); \
    4.35 +      saveHistToFile( _VMSMasterEnv->masterHighTimeHist ); 
    4.36 +      
    4.37  #else
    4.38     #define MEAS__Insert_Master_Meas_Fields_into_Slave
    4.39     #define MEAS__Insert_Master_Meas_Fields_into_MasterEnv 
    4.40 @@ -118,12 +121,12 @@
    4.41  #ifdef MEAS__TURN_ON_MASTER_LOCK_MEAS
    4.42     #define MEAS__Insert_Master_Lock_Meas_Fields_into_MasterEnv \
    4.43         Histogram       *masterLockLowTimeHist; \
    4.44 -       Histogram       *masterLockHighTimeHist;
    4.45 +       //Histogram       *masterLockHighTimeHist;
    4.46  
    4.47     #define MEAS__Make_Meas_Hists_for_Master_Lock_Meas \
    4.48        _VMSMasterEnv->masterLockLowTimeHist  = makeFixedBinHist( 50, 0, 2, \
    4.49                                                 "master lock low time hist");\
    4.50 -      _VMSMasterEnv->masterLockHighTimeHist  = makeFixedBinHist( 50, 0, 100,\
    4.51 +     // _VMSMasterEnv->masterLockHighTimeHist  = makeFixedBinHist( 50, 0, 100,\
    4.52                                                 "master lock high time hist");
    4.53  
    4.54     #define MEAS__Capture_Pre_Master_Lock_Point \
    4.55 @@ -134,12 +137,12 @@
    4.56        saveLowTimeStampCountInto( endStamp ); \
    4.57        addIntervalToHist( startStamp, endStamp,\
    4.58                           _VMSMasterEnv->masterLockLowTimeHist ); \
    4.59 -      addIntervalToHist( startStamp, endStamp,\
    4.60 +      //addIntervalToHist( startStamp, endStamp,\
    4.61                           _VMSMasterEnv->masterLockHighTimeHist );
    4.62  
    4.63     #define MEAS__Print_Hists_for_Master_Lock_Meas \
    4.64        printHist( _VMSMasterEnv->masterLockLowTimeHist ); \
    4.65 -      printHist( _VMSMasterEnv->masterLockHighTimeHist );
    4.66 +      //printHist( _VMSMasterEnv->masterLockHighTimeHist );
    4.67        
    4.68  #else
    4.69     #define MEAS__Insert_Master_Lock_Meas_Fields_into_MasterEnv
    4.70 @@ -202,12 +205,12 @@
    4.71  #ifdef MEAS__TURN_ON_PLUGIN_MEAS 
    4.72     #define MEAS__Insert_Plugin_Meas_Fields_into_MasterEnv \
    4.73        Histogram       *reqHdlrLowTimeHist; \
    4.74 -      Histogram       *reqHdlrHighTimeHist;
    4.75 +      //Histogram       *reqHdlrHighTimeHist;
    4.76            
    4.77     #define MEAS__Make_Meas_Hists_for_Plugin_Meas \
    4.78        _VMSMasterEnv->reqHdlrLowTimeHist  = makeFixedBinHistExt( 100, 0, 200,\
    4.79                                                      "plugin_low_time_hist");\
    4.80 -      _VMSMasterEnv->reqHdlrHighTimeHist  = makeFixedBinHistExt( 100, 0, 200,\
    4.81 +      //_VMSMasterEnv->reqHdlrHighTimeHist  = makeFixedBinHistExt( 100, 0, 200,\
    4.82                                                      "plugin_high_time_hist");
    4.83  
    4.84     #define MEAS__startReqHdlr \
    4.85 @@ -218,13 +221,13 @@
    4.86        saveLowTimeStampCountInto( endStamp1 ); \
    4.87        addIntervalToHist( startStamp1, endStamp1, \
    4.88                             _VMSMasterEnv->reqHdlrLowTimeHist ); \
    4.89 -      addIntervalToHist( startStamp1, endStamp1, \
    4.90 +      //addIntervalToHist( startStamp1, endStamp1, \
    4.91                             _VMSMasterEnv->reqHdlrHighTimeHist );
    4.92  
    4.93     #define MEAS__Print_Hists_for_Plugin_Meas \
    4.94        printHist( _VMSMasterEnv->reqHdlrLowTimeHist ); \
    4.95        saveHistToFile( _VMSMasterEnv->reqHdlrLowTimeHist ); \
    4.96 -      printHist( _VMSMasterEnv->reqHdlrHighTimeHist ); \
    4.97 +      //printHist( _VMSMasterEnv->reqHdlrHighTimeHist ); \
    4.98        saveHistToFile( _VMSMasterEnv->reqHdlrHighTimeHist ); \
    4.99        freeHistExt( _VMSMasterEnv->reqHdlrLowTimeHist ); \
   4.100        freeHistExt( _VMSMasterEnv->reqHdlrHighTimeHist );
   4.101 @@ -408,7 +411,6 @@
   4.102          uint64 cycles2,instrs2,cachem2; \
   4.103          saveCyclesAndInstrs(thisCoresIdx,cycles2, instrs2,cachem2); \
   4.104          (*counterHandler)(AppResponder_end,vpid,task,currSlot->slaveAssignedToSlot,cycles2,instrs2,cachem2); \
   4.105 -        (*counterHandler)(Timestamp_end,vpid,task,currSlot->slaveAssignedToSlot,rdtsc(),0,0);
   4.106  
   4.107     
   4.108     /* Don't know who to account time to yet - goes to assigned VP
   4.109 @@ -421,7 +423,6 @@
   4.110         } \
   4.111         uint64 tmp_cycles, tmp_instrs, tmp_cachem; \
   4.112         saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs,tmp_cachem); \
   4.113 -       uint64 tsc = rdtsc(); \
   4.114         if(vpid > 0) { \
   4.115             (*counterHandler)(NextAssigner_start,vpid,task,currSlot->slaveAssignedToSlot,tmp_cycles,tmp_instrs,tmp_cachem); \
   4.116             vpid = 0; \
   4.117 @@ -434,9 +435,8 @@
   4.118          if(empty){ \
   4.119              (*counterHandler)(AssignerInvocation_start,assignedSlaveVP->slaveID,assignedSlaveVP->assignCount,assignedSlaveVP,masterEnv->start_master_lock[thisCoresIdx][0],masterEnv->start_master_lock[thisCoresIdx][1],masterEnv->start_master_lock[thisCoresIdx][2]); \
   4.120          } \
   4.121 -        (*counterHandler)(Timestamp_start,assignedSlaveVP->slaveID,assignedSlaveVP->assignCount,assignedSlaveVP,tsc,0,0); \
   4.122          (*counterHandler)(Assigner_start,assignedSlaveVP->slaveID,assignedSlaveVP->assignCount,assignedSlaveVP,tmp_cycles,tmp_instrs,tmp_cachem); \
   4.123 -        (*counterHandler)(Assigner_end,assignedSlaveVP->slaveID,assignedSlaveVP->assignCount,assignedSlaveVP,cycles,instrs,tmp_cachem);
   4.124 +        (*counterHandler)(Assigner_end,assignedSlaveVP->slaveID,assignedSlaveVP->assignCount,assignedSlaveVP,cycles,instrs,cachem);
   4.125  
   4.126     #define HOLISTIC__Record_Work_start \
   4.127          if(currVP){ \
     5.1 --- a/Services_Offered_by_VMS/Memory_Handling/vmalloc.c	Wed Mar 06 14:32:23 2013 +0100
     5.2 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.c	Wed Mar 27 18:06:37 2013 +0100
     5.3 @@ -311,7 +311,9 @@
     5.4  void *
     5.5  VMS_WL__malloc( size_t sizeRequested )
     5.6   { void *ret;
     5.7 - 
     5.8 +     #ifdef USE_SYS_MALLOC
     5.9 +    return malloc(sizeRequested);
    5.10 +#endif
    5.11     VMS_int__get_master_lock();
    5.12     ret = VMS_int__malloc( sizeRequested );
    5.13     VMS_int__release_master_lock();
    5.14 @@ -383,6 +385,10 @@
    5.15  void
    5.16  VMS_WL__free( void *ptrToFree )
    5.17   {
    5.18 +#ifdef USE_SYS_MALLOC
    5.19 +    free(ptrToFree);
    5.20 +    return;
    5.21 +#endif
    5.22     VMS_int__get_master_lock();
    5.23     VMS_int__free( ptrToFree );
    5.24     VMS_int__release_master_lock();
    5.25 @@ -415,7 +421,9 @@
    5.26  void*
    5.27  VMS_WL__realloc(void *oldPtr, size_t sizeRequested)
    5.28   {
    5.29 -    
    5.30 +#ifdef USE_SYS_MALLOC
    5.31 +    return realloc(oldPtr,sizeRequested);
    5.32 +#endif
    5.33     VMS_int__get_master_lock();
    5.34     void* newPtr = VMS_int__realloc(oldPtr, sizeRequested);
    5.35     VMS_int__release_master_lock();