diff VMS.h @ 38:17d20e5cf924

measures coreloop and masterVP times
author Me
date Tue, 07 Sep 2010 18:40:57 -0700
parents e69579a0e797
children cf3e9238aeb0
line diff
     1.1 --- a/VMS.h	Wed Sep 01 08:23:39 2010 -0700
     1.2 +++ b/VMS.h	Tue Sep 07 18:40:57 2010 -0700
     1.3 @@ -12,12 +12,22 @@
     1.4  
     1.5  #include "VMS_primitive_data_types.h"
     1.6  #include "Queue_impl/BlockingQueue.h"
     1.7 +#include "Histogram/Histogram.h"
     1.8  #include <pthread.h>
     1.9  
    1.10     //When DEBUG is defined, VMS does sequential exe in the main thread
    1.11     // It still does co-routines and all the mechanisms are the same, it just
    1.12     // has only a single thread and animates VPs one at a time
    1.13 -//#define DEBUG
    1.14 +#define SEQUENTIAL
    1.15 +
    1.16 +   //when MEAS__TAKE_SUSP_TSC is defined, causes code to be inserted and
    1.17 +   // compiled-in that saves the low part of the time stamp count just before
    1.18 +   // suspending a processor and just after resuming that processor.  It is
    1.19 +   // saved into a field added to VirtProcr.  Have to sanity-check for
    1.20 +   // rollover of low portion into high portion.
    1.21 +#define MEAS__TIME_STAMP_SUSP
    1.22 +#define MEAS__TIME_MASTER
    1.23 +#define MEAS__NUM_TIMES_TO_RUN 100000
    1.24  
    1.25     //This value is the number of hardware threads in the shared memory
    1.26     // machine
    1.27 @@ -59,8 +69,6 @@
    1.28   {
    1.29     void           *endThdPt;
    1.30     unsigned int    coreNum;
    1.31 -//   void           *framePtr;
    1.32 -//   void           *stackPtr;
    1.33   }
    1.34  ThdParams;
    1.35  
    1.36 @@ -109,6 +117,17 @@
    1.37     VMSReqst   *requests;
    1.38  
    1.39     void       *semanticData;
    1.40 +
    1.41 +   //============================= MEASUREMENT STUFF ========================
    1.42 +   #ifdef MEAS__TIME_STAMP_SUSP
    1.43 +   unsigned int preSuspTSCLow;
    1.44 +   unsigned int postSuspTSCLow;
    1.45 +   #endif
    1.46 +   #ifdef MEAS__TIME_MASTER
    1.47 +   unsigned int startMasterTSCLow;
    1.48 +   unsigned int endMasterTSCLow;
    1.49 +   #endif
    1.50 +   //========================================================================
    1.51   };
    1.52  //VirtProcr
    1.53  
    1.54 @@ -131,6 +150,15 @@
    1.55  
    1.56     int              setupComplete;
    1.57     int              masterLock;
    1.58 +
    1.59 +   //============================= MEASUREMENT STUFF ========================
    1.60 +   #ifdef MEAS__TIME_STAMP_SUSP
    1.61 +   Histogram   *measSuspHist;
    1.62 +   #endif
    1.63 +   #ifdef MEAS__TIME_MASTER
    1.64 +   Histogram   *measMasterHist;
    1.65 +   #endif
    1.66 +   //========================================================================
    1.67   }
    1.68  MasterEnv;
    1.69  
    1.70 @@ -176,7 +204,7 @@
    1.71  VMS__add_sem_request( void *semReqData, VirtProcr *callingPr );
    1.72  
    1.73  void
    1.74 -VMS__send_register_new_procr_request( VirtProcr *newPrToRegister,
    1.75 +VMS__send_req_to_register_new_procr( VirtProcr *newPrToRegister,
    1.76                                        VirtProcr *reqstingPr );
    1.77  
    1.78  void
    1.79 @@ -234,6 +262,14 @@
    1.80     /* clobber */ : "%eax", "%edx"         \
    1.81                  );
    1.82  
    1.83 +#define saveLowTimeStampCountInto(low)    \
    1.84 +   asm volatile("RDTSC;                   \
    1.85 +                 movl %%eax, %0;"         \
    1.86 +   /* outputs */ : "=m" (low)             \
    1.87 +   /* inputs  */ :                        \
    1.88 +   /* clobber */ : "%eax", "%edx"         \
    1.89 +                );
    1.90 +
    1.91  inline TSCount getTSCount();
    1.92  
    1.93  //===================== Debug ==========================