diff VMS.h @ 68:9c3107044f86

Added measurement hists macros
author Me
date Sat, 20 Nov 2010 08:19:05 +0100
parents 2377967a2732
children 11bfe9d136ed a49f02980151
line diff
     1.1 --- a/VMS.h	Tue Nov 16 16:00:32 2010 +0100
     1.2 +++ b/VMS.h	Sat Nov 20 08:19:05 2010 +0100
     1.3 @@ -37,14 +37,14 @@
     1.4  
     1.5     //These defines turn types of bug messages on and off
     1.6     // be sure debug messages are un-commented (next block of defines)
     1.7 +#define dbgAppFlow   TRUE /* Top level flow of application code -- general*/
     1.8  #define dbgProbes    FALSE /* for issues inside probes themselves*/
     1.9 -#define dbgAppFlow   FALSE /* Top level flow of application code -- general*/
    1.10  #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/
    1.11  #define dbgRqstHdlr  FALSE /* in request handler code*/
    1.12  
    1.13     //Comment or un- the substitute half to turn on/off types of debug message
    1.14  #define DEBUG(  bool, msg)         \
    1.15 -//   if( bool){ printf(msg); fflush(stdin);}
    1.16 +//  if( bool){ printf(msg); fflush(stdin);}
    1.17  #define DEBUG1( bool, msg, param)  \
    1.18  //   if(bool){printf(msg, param); fflush(stdin);}
    1.19  #define DEBUG2( bool, msg, p1, p2) \
    1.20 @@ -65,7 +65,7 @@
    1.21  //#define MEAS__TIME_MASTER
    1.22  #define MEAS__TIME_PLUGIN
    1.23  #define MEAS__TIME_MALLOC
    1.24 -#define MEAS__TIME_MASTER_LOCK
    1.25 +//#define MEAS__TIME_MASTER_LOCK
    1.26  #define MEAS__NUM_TIMES_TO_RUN 100000
    1.27  
    1.28     //For code that calculates normalization-offset between TSC counts of
    1.29 @@ -242,9 +242,11 @@
    1.30     HashTable       *probeNameHashTbl;
    1.31     int32            masterCreateProbeID;
    1.32     float64          createPtInSecs;
    1.33 +   Histogram      **measHists;
    1.34 +   PrivDynArrayInfo *measHistsInfo;
    1.35     #ifdef MEAS__TIME_PLUGIN
    1.36 -   Histogram       *pluginLowTimeHist;
    1.37 -   Histogram       *pluginHighTimeHist;
    1.38 +   Histogram       *reqHdlrLowTimeHist;
    1.39 +   Histogram       *reqHdlrHighTimeHist;
    1.40     #endif
    1.41     #ifdef MEAS__TIME_MALLOC
    1.42     Histogram       *mallocTimeHist;
    1.43 @@ -390,6 +392,77 @@
    1.44     /* inputs  */ :                        \
    1.45     /* clobber */ : "%eax", "%edx"         \
    1.46                  );
    1.47 +
    1.48 +//====================
    1.49 +#define makeAMeasHist( idx, name, numBins, startVal, binWidth ) \
    1.50 +   makeHighestDynArrayIndexBeAtLeast( _VMSMasterEnv->measHistsInfo, idx ); \
    1.51 +   _VMSMasterEnv->measHists[idx] =  \
    1.52 +                       makeFixedBinHist( numBins, startVal, binWidth, name );
    1.53 +
    1.54 +
    1.55 +#define MEAS__SUB_CREATE  /*turn on/off subtraction of create from plugin*/
    1.56 +#define createHistIdx      1
    1.57 +#define mutexLockHistIdx   2
    1.58 +#define mutexUnlockHistIdx 3
    1.59 +#define condWaitHistIdx    4
    1.60 +#define condSignalHistIdx  5
    1.61 +
    1.62 +
    1.63 +#define MakeTheMeasHists \
    1.64 +   _VMSMasterEnv->measHistsInfo = \
    1.65 +              makePrivDynArrayOfSize( &(_VMSMasterEnv->measHists), 200);\
    1.66 +   makeAMeasHist( createHistIdx,      "Create",        50, 0, 200 ) \
    1.67 +   makeAMeasHist( mutexLockHistIdx,   "mutex lock",    50, 0, 100 ) \
    1.68 +   makeAMeasHist( mutexUnlockHistIdx, "mutex unlock",  50, 0, 100 ) \
    1.69 +   makeAMeasHist( condWaitHistIdx,    "cond wait",     50, 0, 100 ) \
    1.70 +   makeAMeasHist( condSignalHistIdx,  "cond signal",   50, 0, 100 )
    1.71 +
    1.72 +#define Meas_startCreate \
    1.73 +    int32 startStamp, endStamp; \
    1.74 +    saveLowTimeStampCountInto( startStamp ); \
    1.75 +
    1.76 +#define Meas_endCreate \
    1.77 +    saveLowTimeStampCountInto( endStamp ); \
    1.78 +    addIntervalToHist( startStamp, endStamp, \
    1.79 +                                 _VMSMasterEnv->measHists[ createHistIdx ] );
    1.80 +
    1.81 +#define Meas_startMutexLock \
    1.82 +    int32 startStamp, endStamp; \
    1.83 +    saveLowTimeStampCountInto( startStamp ); \
    1.84 +
    1.85 +#define Meas_endMutexLock \
    1.86 +    saveLowTimeStampCountInto( endStamp ); \
    1.87 +    addIntervalToHist( startStamp, endStamp, \
    1.88 +                              _VMSMasterEnv->measHists[ mutexLockHistIdx ] );
    1.89 +
    1.90 +#define Meas_startMutexUnlock \
    1.91 +    int32 startStamp, endStamp; \
    1.92 +    saveLowTimeStampCountInto( startStamp ); \
    1.93 +
    1.94 +#define Meas_endMutexUnlock \
    1.95 +    saveLowTimeStampCountInto( endStamp ); \
    1.96 +    addIntervalToHist( startStamp, endStamp, \
    1.97 +                            _VMSMasterEnv->measHists[ mutexUnlockHistIdx ] );
    1.98 +
    1.99 +#define Meas_startCondWait \
   1.100 +    int32 startStamp, endStamp; \
   1.101 +    saveLowTimeStampCountInto( startStamp ); \
   1.102 +
   1.103 +#define Meas_endCondWait \
   1.104 +    saveLowTimeStampCountInto( endStamp ); \
   1.105 +    addIntervalToHist( startStamp, endStamp, \
   1.106 +                               _VMSMasterEnv->measHists[ condWaitHistIdx ] );
   1.107 +
   1.108 +#define Meas_startCondSignal \
   1.109 +    int32 startStamp, endStamp; \
   1.110 +    saveLowTimeStampCountInto( startStamp ); \
   1.111 +
   1.112 +#define Meas_endCondSignal \
   1.113 +    saveLowTimeStampCountInto( endStamp ); \
   1.114 +    addIntervalToHist( startStamp, endStamp, \
   1.115 +                             _VMSMasterEnv->measHists[ condSignalHistIdx ] );
   1.116 +
   1.117 +
   1.118  //=====
   1.119  
   1.120  #include "SwitchAnimators.h"