Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.h @ 25:c556193f7211
Linux Version -- first set of mods changing from win to linux
| author | Me |
|---|---|
| date | Sat, 24 Jul 2010 08:58:47 -0700 |
| parents | 2b161e1a50ee |
| children | 668278fa7a63 |
comparison
equal
deleted
inserted
replaced
| 6:6e535b1d3f58 | 7:563990bca016 |
|---|---|
| 6 * | 6 * |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef _VMS_H | 9 #ifndef _VMS_H |
| 10 #define _VMS_H | 10 #define _VMS_H |
| 11 #define __USE_GNU | |
| 11 | 12 |
| 12 #include "VMS_primitive_data_types.h" | 13 #include "VMS_primitive_data_types.h" |
| 13 #include "Queue_impl/BlockingQueue.h" | 14 #include "Queue_impl/BlockingQueue.h" |
| 14 #include <windows.h> | 15 #include "pthread.h" |
| 15 #include <winbase.h> | |
| 16 | 16 |
| 17 //This value is the number of hardware threads in the shared memory | 17 //This value is the number of hardware threads in the shared memory |
| 18 // machine | 18 // machine |
| 19 #define NUM_CORES 4 | 19 #define NUM_CORES 4 |
| 20 | 20 |
| 106 int numFilled; | 106 int numFilled; |
| 107 | 107 |
| 108 int stillRunning; | 108 int stillRunning; |
| 109 | 109 |
| 110 VirtProcr *masterVirtPr; | 110 VirtProcr *masterVirtPr; |
| 111 | |
| 111 void *semanticEnv; | 112 void *semanticEnv; |
| 112 void *OSEventStruc; //for future, when add I/O to BLIS | 113 void *OSEventStruc; //for future, when add I/O to BLIS |
| 113 | 114 |
| 114 void *coreLoopShutDownPt; //addr to jump to to shut down a coreLoop | 115 void *coreLoopShutDownPt; //addr to jump to to shut down a coreLoop |
| 116 | |
| 117 int setupComplete; | |
| 118 pthread_mutex_t suspend_mutex; | |
| 119 pthread_cond_t suspend_cond; | |
| 115 } | 120 } |
| 116 MasterEnv; | 121 MasterEnv; |
| 117 | 122 |
| 118 | 123 |
| 119 //========================================================== | 124 //========================================================== |
| 120 | 125 |
| 121 DWORD WINAPI coreLoop( LPVOID paramsIn ); | 126 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype |
| 122 //void * coreLoop( void *paramsIn ); //standard PThreads fn prototype | |
| 123 void masterLoop( void *initData, VirtProcr *masterPr ); | 127 void masterLoop( void *initData, VirtProcr *masterPr ); |
| 124 | 128 |
| 125 | 129 |
| 126 //===================== Global Vars =================== | 130 //===================== Global Vars =================== |
| 127 | 131 |
| 128 | 132 |
| 129 HANDLE coreLoopThdHandles[ NUM_CORES ]; //windows handle to thread | 133 pthread_t coreLoopThdHandles[ NUM_CORES ]; //pthread's virt-procr state |
| 130 ThdParams *coreLoopThdParams[ NUM_CORES ]; | 134 ThdParams *coreLoopThdParams[ NUM_CORES ]; |
| 131 DWORD coreLoopThdIds[ NUM_CORES ]; | 135 |
| 132 | |
| 133 //TODO: Debug: figure out if need to be volatile or not | |
| 134 volatile MasterEnv *_VMSMasterEnv; | 136 volatile MasterEnv *_VMSMasterEnv; |
| 135 | 137 |
| 136 //workQ is global, static, and volatile so that core loop has its location | 138 //workQ is global, static, and volatile so that core loop has its location |
| 137 // hard coded, and reloads every time through the loop -- that way don't | 139 // hard coded, and reloads every time through the loop -- that way don't |
| 138 // need to save any regs used by core loop (will see if this really works) | 140 // need to save any regs used by core loop |
| 139 volatile CASQueueStruc *_VMSWorkQ; | 141 volatile CASQueueStruc *_VMSWorkQ; |
| 140 | 142 |
| 141 //========================== | 143 //========================== |
| 142 void | 144 void |
| 143 VMS__init(); | 145 VMS__init(); |
| 192 VMS__shutdown(); | 194 VMS__shutdown(); |
| 193 | 195 |
| 194 //============================= Statistics ================================== | 196 //============================= Statistics ================================== |
| 195 | 197 |
| 196 typedef unsigned long long TSCount; | 198 typedef unsigned long long TSCount; |
| 199 | |
| 200 //Frequency of TS counts | |
| 201 //TODO: change freq for each machine | |
| 202 #define TSCOUNT_FREQ 3180000000 | |
| 197 | 203 |
| 198 #define saveTimeStampCountInto(low, high) \ | 204 #define saveTimeStampCountInto(low, high) \ |
| 199 asm volatile("RDTSC; \ | 205 asm volatile("RDTSC; \ |
| 200 movl %%eax, %0; \ | 206 movl %%eax, %0; \ |
| 201 movl %%edx, %1;" \ | 207 movl %%edx, %1;" \ |
