diff VMS.h @ 13:4b58b9a2527b

Middle of testing core loop
author Me
date Sat, 19 Jun 2010 19:26:49 -0700
parents f96e4b3b35c7
children c3e6c3fda84e
line diff
     1.1 --- a/VMS.h	Sat Jun 19 19:26:38 2010 -0700
     1.2 +++ b/VMS.h	Sat Jun 19 19:26:49 2010 -0700
     1.3 @@ -12,6 +12,7 @@
     1.4  #include "VMS_primitive_data_types.h"
     1.5  #include "Queue_impl/BlockingQueue.h"
     1.6  #include <windows.h>
     1.7 +#include <winbase.h>
     1.8  
     1.9  //This value is the number of hardware threads in the shared memory
    1.10  // machine -- make double that number scheduling slots, plus extra for master
    1.11 @@ -20,7 +21,7 @@
    1.12  
    1.13  #define SUCCESS 0
    1.14  
    1.15 -#define thdAttrs NULL
    1.16 +//#define thdAttrs NULL  //For PThreads
    1.17  
    1.18  typedef struct _WorkUnit   WorkUnit;
    1.19  typedef struct _VirtProcr  VirtProcr;
    1.20 @@ -48,7 +49,7 @@
    1.21  
    1.22  
    1.23  struct _VirtProcr
    1.24 - {
    1.25 + { int         procrID;  //for debugging -- count up each time create
    1.26     void       *stackPtr;
    1.27     void       *framePtr;
    1.28     void       *nextInstrPt;
    1.29 @@ -102,16 +103,17 @@
    1.30  //=====================  Global Vars ===================
    1.31  
    1.32  
    1.33 -HANDLE      coreLoopThds[ NUM_CORES ];  //windows handle to thread
    1.34 -ThdParams     *thdParams[ NUM_CORES ];
    1.35 -DWORD             thdIds[ NUM_CORES ];
    1.36 +HANDLE      coreLoopThdHandles[ NUM_CORES ];  //windows handle to thread
    1.37 +ThdParams   *coreLoopThdParams[ NUM_CORES ];
    1.38 +DWORD           coreLoopThdIds[ NUM_CORES ];
    1.39  
    1.40 -volatile MasterEnv     *_VMSMasterEnv;
    1.41 +   //TODO: Debug: figure out if need to be volatile or not
    1.42 +volatile MasterEnv      *_VMSMasterEnv;
    1.43  
    1.44     //workQ is global, static, and volatile so that core loop has its location
    1.45     // hard coded, and reloads every time through the loop -- that way don't
    1.46     // need to save any regs used by core loop (will see if this really works)
    1.47 -volatile QueueStruc    *_VMSWorkQ;
    1.48 +volatile CASQueueStruc  *_VMSWorkQ;
    1.49  
    1.50  //==========================
    1.51  void
    1.52 @@ -129,6 +131,22 @@
    1.53  void
    1.54  VMS__suspend_processor( VirtProcr *callingPr );
    1.55  
    1.56 +//============================= Statistics ==================================
    1.57 +
    1.58 +typedef unsigned long long TSCount;
    1.59 +
    1.60 +#define saveTimeStampCountInto(low, high) \
    1.61 +   asm volatile("RDTSC;                   \
    1.62 +                 movl %%eax, %0;          \
    1.63 +                 movl %%edx, %1;"         \
    1.64 +   /* outputs */ : "=m" (low), "=m" (high)\
    1.65 +   /* inputs  */ :                        \
    1.66 +   /* clobber */ : "%eax", "%edx"         \
    1.67 +                );
    1.68 +
    1.69 +inline TSCount getTSCount();
    1.70 +
    1.71 +int numProcrsCreated;
    1.72  
    1.73  #endif	/* _VMS_H */
    1.74