| rev |
line source |
|
Me@42
|
1 /*
|
|
Me@42
|
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
|
|
Me@42
|
3 * Licensed under GNU General Public License version 2
|
|
Me@42
|
4 *
|
|
Me@42
|
5 * Author: seanhalle@yahoo.com
|
|
Me@42
|
6 *
|
|
Me@42
|
7 */
|
|
Me@42
|
8
|
|
Me@42
|
9 #ifndef _VMS_H
|
|
Me@42
|
10 #define _VMS_H
|
|
Me@42
|
11 #define __USE_GNU
|
|
Me@42
|
12
|
|
Me@42
|
13 #include "VMS_primitive_data_types.h"
|
|
Me@55
|
14 #include "Queue_impl/PrivateQueue.h"
|
|
Me@42
|
15 #include "Histogram/Histogram.h"
|
|
Me@50
|
16 #include "DynArray/DynArray.h"
|
|
Me@50
|
17 #include "Hash_impl/PrivateHash.h"
|
|
Me@50
|
18 #include "vmalloc.h"
|
|
Me@50
|
19
|
|
Me@42
|
20 #include <pthread.h>
|
|
Me@50
|
21 #include <sys/time.h>
|
|
msach@70
|
22 #include <ucontext.h>
|
|
Me@42
|
23
|
|
Me@50
|
24
|
|
Me@50
|
25 //=============================== Debug ===================================
|
|
Me@55
|
26 //
|
|
Me@45
|
27 //When SEQUENTIAL is defined, VMS does sequential exe in the main thread
|
|
Me@42
|
28 // It still does co-routines and all the mechanisms are the same, it just
|
|
Me@42
|
29 // has only a single thread and animates VPs one at a time
|
|
Me@45
|
30 //#define SEQUENTIAL
|
|
Me@42
|
31
|
|
Me@55
|
32 //#define USE_WORK_STEALING
|
|
Me@55
|
33
|
|
Me@52
|
34 //turns on the probe-instrumentation in the application -- when not
|
|
Me@52
|
35 // defined, the calls to the probe functions turn into comments
|
|
Me@52
|
36 #define STATS__ENABLE_PROBES
|
|
Me@60
|
37 //#define TURN_ON_DEBUG_PROBES
|
|
Me@52
|
38
|
|
Me@55
|
39 //These defines turn types of bug messages on and off
|
|
Me@55
|
40 // be sure debug messages are un-commented (next block of defines)
|
|
Me@68
|
41 #define dbgAppFlow TRUE /* Top level flow of application code -- general*/
|
|
Me@60
|
42 #define dbgProbes FALSE /* for issues inside probes themselves*/
|
|
Me@60
|
43 #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/
|
|
Me@60
|
44 #define dbgRqstHdlr FALSE /* in request handler code*/
|
|
Me@52
|
45
|
|
Me@55
|
46 //Comment or un- the substitute half to turn on/off types of debug message
|
|
Me@55
|
47 #define DEBUG( bool, msg) \
|
|
Me@68
|
48 // if( bool){ printf(msg); fflush(stdin);}
|
|
Me@55
|
49 #define DEBUG1( bool, msg, param) \
|
|
Me@60
|
50 // if(bool){printf(msg, param); fflush(stdin);}
|
|
Me@55
|
51 #define DEBUG2( bool, msg, p1, p2) \
|
|
Me@60
|
52 // if(bool) {printf(msg, p1, p2); fflush(stdin);}
|
|
Me@45
|
53
|
|
msach@70
|
54 #define ERROR(msg) printf(msg);
|
|
msach@70
|
55 #define ERROR1(msg, param) printf(msg, param);
|
|
msach@70
|
56 #define ERROR2(msg, p1, p2) printf(msg, p1, p2);
|
|
Me@50
|
57
|
|
Me@50
|
58 //=========================== STATS =======================
|
|
Me@50
|
59
|
|
Me@45
|
60 //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and
|
|
Me@42
|
61 // compiled-in that saves the low part of the time stamp count just before
|
|
Me@42
|
62 // suspending a processor and just after resuming that processor. It is
|
|
Me@42
|
63 // saved into a field added to VirtProcr. Have to sanity-check for
|
|
Me@42
|
64 // rollover of low portion into high portion.
|
|
Me@65
|
65 //#define MEAS__TIME_STAMP_SUSP
|
|
Me@65
|
66 //#define MEAS__TIME_MASTER
|
|
Me@67
|
67 #define MEAS__TIME_PLUGIN
|
|
Me@67
|
68 #define MEAS__TIME_MALLOC
|
|
Me@68
|
69 //#define MEAS__TIME_MASTER_LOCK
|
|
Me@42
|
70 #define MEAS__NUM_TIMES_TO_RUN 100000
|
|
Me@42
|
71
|
|
Me@55
|
72 //For code that calculates normalization-offset between TSC counts of
|
|
Me@55
|
73 // different cores.
|
|
Me@45
|
74 #define NUM_TSC_ROUND_TRIPS 10
|
|
Me@45
|
75
|
|
Me@50
|
76
|
|
Me@50
|
77 //========================= Hardware related Constants =====================
|
|
Me@42
|
78 //This value is the number of hardware threads in the shared memory
|
|
Me@42
|
79 // machine
|
|
msach@69
|
80 #define NUM_CORES 8
|
|
Me@42
|
81
|
|
Me@55
|
82 // tradeoff amortizing master fixed overhead vs imbalance potential
|
|
Me@55
|
83 // when work-stealing, can make bigger, at risk of losing cache affinity
|
|
Me@55
|
84 #define NUM_SCHED_SLOTS 5
|
|
Me@42
|
85
|
|
Me@45
|
86 #define MIN_WORK_UNIT_CYCLES 20000
|
|
Me@45
|
87
|
|
Me@53
|
88 #define MASTERLOCK_RETRIES 10000
|
|
Me@42
|
89
|
|
Me@54
|
90 // stack size in virtual processors created
|
|
Me@54
|
91 #define VIRT_PROCR_STACK_SIZE 0x4000 /* 16K */
|
|
Me@42
|
92
|
|
Me@54
|
93 // memory for VMS__malloc
|
|
Me@54
|
94 #define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000 /* 256M */
|
|
Me@42
|
95
|
|
Me@50
|
96
|
|
Me@50
|
97 //==============================
|
|
Me@42
|
98
|
|
Me@42
|
99 #define SUCCESS 0
|
|
Me@42
|
100
|
|
Me@55
|
101 #define writeVMSQ writePrivQ
|
|
Me@55
|
102 #define readVMSQ readPrivQ
|
|
Me@64
|
103 #define makeVMSQ makeVMSPrivQ
|
|
Me@55
|
104 #define numInVMSQ numInPrivQ
|
|
Me@55
|
105 #define VMSQueueStruc PrivQueueStruc
|
|
Me@42
|
106
|
|
Me@42
|
107
|
|
Me@50
|
108
|
|
Me@50
|
109 //===========================================================================
|
|
Me@50
|
110 typedef unsigned long long TSCount;
|
|
Me@50
|
111
|
|
Me@50
|
112 typedef struct _SchedSlot SchedSlot;
|
|
Me@50
|
113 typedef struct _VMSReqst VMSReqst;
|
|
Me@50
|
114 typedef struct _VirtProcr VirtProcr;
|
|
Me@50
|
115 typedef struct _IntervalProbe IntervalProbe;
|
|
Me@55
|
116 typedef struct _GateStruc GateStruc;
|
|
Me@55
|
117
|
|
Me@42
|
118
|
|
Me@42
|
119 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx
|
|
Me@42
|
120 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv
|
|
Me@42
|
121 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr
|
|
Me@42
|
122 typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr
|
|
Me@50
|
123 typedef void (*ResumePrFnPtr) ( VirtProcr *, void * );
|
|
Me@50
|
124
|
|
Me@50
|
125
|
|
Me@50
|
126 //============= Requests ===========
|
|
Me@50
|
127 //
|
|
Me@50
|
128
|
|
Me@50
|
129 enum VMSReqstType //avoid starting enums at 0, for debug reasons
|
|
Me@50
|
130 {
|
|
Me@50
|
131 semantic = 1,
|
|
Me@50
|
132 createReq,
|
|
Me@50
|
133 dissipate,
|
|
Me@50
|
134 VMSSemantic //goes with VMSSemReqst below
|
|
Me@50
|
135 };
|
|
Me@50
|
136
|
|
Me@50
|
137 struct _VMSReqst
|
|
Me@50
|
138 {
|
|
Me@50
|
139 enum VMSReqstType reqType;//used for dissipate and in future for IO requests
|
|
Me@50
|
140 void *semReqData;
|
|
Me@50
|
141
|
|
Me@50
|
142 VMSReqst *nextReqst;
|
|
Me@50
|
143 };
|
|
Me@50
|
144 //VMSReqst
|
|
Me@50
|
145
|
|
Me@50
|
146 enum VMSSemReqstType //These are equivalent to semantic requests, but for
|
|
Me@50
|
147 { // VMS's services available directly to app, like OS
|
|
Me@50
|
148 createProbe = 1, // and probe services -- like a VMS-wide built-in lang
|
|
Me@50
|
149 openFile,
|
|
Me@50
|
150 otherIO
|
|
Me@50
|
151 };
|
|
Me@42
|
152
|
|
Me@42
|
153 typedef struct
|
|
Me@50
|
154 { enum VMSSemReqstType reqType;
|
|
Me@50
|
155 VirtProcr *requestingPr;
|
|
Me@50
|
156 char *nameStr; //for create probe
|
|
Me@42
|
157 }
|
|
Me@50
|
158 VMSSemReq;
|
|
Me@42
|
159
|
|
Me@42
|
160
|
|
Me@50
|
161 //==================== Core data structures ===================
|
|
Me@50
|
162
|
|
Me@42
|
163 struct _SchedSlot
|
|
Me@42
|
164 {
|
|
Me@42
|
165 int workIsDone;
|
|
Me@42
|
166 int needsProcrAssigned;
|
|
Me@42
|
167 VirtProcr *procrAssignedToSlot;
|
|
Me@42
|
168 };
|
|
Me@42
|
169 //SchedSlot
|
|
Me@42
|
170
|
|
Me@62
|
171 /*WARNING: re-arranging this data structure could cause VP switching
|
|
Me@64
|
172 * assembly code to fail -- hard-codes offsets of fields
|
|
Me@62
|
173 */
|
|
Me@42
|
174 struct _VirtProcr
|
|
Me@42
|
175 { int procrID; //for debugging -- count up each time create
|
|
Me@42
|
176 int coreAnimatedBy;
|
|
Me@42
|
177 void *startOfStack;
|
|
msach@70
|
178 //void *stackPtr;
|
|
msach@70
|
179 //void *framePtr;
|
|
msach@70
|
180 //void *nextInstrPt;
|
|
msach@70
|
181 ucontext_t *savedVPStatus;
|
|
Me@42
|
182
|
|
msach@70
|
183 //void *coreLoopStartPt; //allows proto-runtime to be linked later
|
|
msach@70
|
184 //void *coreLoopFramePtr; //restore before jmp back to core loop
|
|
msach@70
|
185 //void *coreLoopStackPtr; //restore before jmp back to core loop
|
|
msach@70
|
186 ucontext_t *savedCoreLoopStatus;
|
|
Me@42
|
187
|
|
Me@42
|
188 void *initialData;
|
|
Me@42
|
189
|
|
Me@42
|
190 SchedSlot *schedSlot;
|
|
Me@42
|
191 VMSReqst *requests;
|
|
Me@42
|
192
|
|
Me@50
|
193 void *semanticData; //this lives here for the life of VP
|
|
Me@53
|
194 void *dataRetFromReq;//values returned from plugin to VP go here
|
|
Me@42
|
195
|
|
Me@50
|
196 //=========== MEASUREMENT STUFF ==========
|
|
Me@42
|
197 #ifdef MEAS__TIME_STAMP_SUSP
|
|
Me@42
|
198 unsigned int preSuspTSCLow;
|
|
Me@42
|
199 unsigned int postSuspTSCLow;
|
|
Me@42
|
200 #endif
|
|
Me@65
|
201 #ifdef MEAS__TIME_MASTER /* in VirtProcr because multiple masterVPs*/
|
|
Me@42
|
202 unsigned int startMasterTSCLow;
|
|
Me@42
|
203 unsigned int endMasterTSCLow;
|
|
Me@42
|
204 #endif
|
|
Me@65
|
205 //========================================
|
|
Me@50
|
206
|
|
Me@50
|
207 float64 createPtInSecs; //have space but don't use on some configs
|
|
Me@42
|
208 };
|
|
Me@42
|
209 //VirtProcr
|
|
Me@42
|
210
|
|
Me@42
|
211
|
|
Me@62
|
212 /*WARNING: re-arranging this data structure could cause VP-switching
|
|
Me@62
|
213 * assembly code to fail -- hard-codes offsets of fields
|
|
Me@62
|
214 * (because -O3 messes with things otherwise)
|
|
Me@62
|
215 */
|
|
Me@42
|
216 typedef struct
|
|
Me@42
|
217 {
|
|
Me@42
|
218 SlaveScheduler slaveScheduler;
|
|
Me@42
|
219 RequestHandler requestHandler;
|
|
Me@42
|
220
|
|
Me@42
|
221 SchedSlot ***allSchedSlots;
|
|
Me@55
|
222 VMSQueueStruc **readyToAnimateQs;
|
|
Me@42
|
223 VirtProcr **masterVPs;
|
|
Me@42
|
224
|
|
Me@42
|
225 void *semanticEnv;
|
|
Me@42
|
226 void *OSEventStruc; //for future, when add I/O to BLIS
|
|
Me@50
|
227 MallocProlog *freeListHead;
|
|
Me@50
|
228 int32 amtOfOutstandingMem; //total currently allocated
|
|
Me@42
|
229
|
|
msach@70
|
230 //void *coreLoopStartPt;//addr to jump to to re-enter coreLoop
|
|
msach@70
|
231 //void *coreLoopEndPt; //addr to jump to to shut down a coreLoop
|
|
Me@42
|
232
|
|
Me@50
|
233 int32 setupComplete;
|
|
msach@70
|
234 volatile int32 masterLock;
|
|
Me@42
|
235
|
|
Me@50
|
236 int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP
|
|
Me@59
|
237 GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal
|
|
Me@55
|
238 int32 workStealingLock;
|
|
Me@55
|
239
|
|
Me@50
|
240 int32 numProcrsCreated; //gives ordering to processor creation
|
|
Me@50
|
241
|
|
Me@50
|
242 //=========== MEASUREMENT STUFF =============
|
|
Me@50
|
243 IntervalProbe **intervalProbes;
|
|
Me@53
|
244 PrivDynArrayInfo *dynIntervalProbesInfo;
|
|
Me@50
|
245 HashTable *probeNameHashTbl;
|
|
Me@50
|
246 int32 masterCreateProbeID;
|
|
Me@50
|
247 float64 createPtInSecs;
|
|
Me@68
|
248 Histogram **measHists;
|
|
Me@68
|
249 PrivDynArrayInfo *measHistsInfo;
|
|
Me@65
|
250 #ifdef MEAS__TIME_PLUGIN
|
|
Me@68
|
251 Histogram *reqHdlrLowTimeHist;
|
|
Me@68
|
252 Histogram *reqHdlrHighTimeHist;
|
|
Me@65
|
253 #endif
|
|
Me@65
|
254 #ifdef MEAS__TIME_MALLOC
|
|
Me@65
|
255 Histogram *mallocTimeHist;
|
|
Me@65
|
256 Histogram *freeTimeHist;
|
|
Me@65
|
257 #endif
|
|
Me@65
|
258 #ifdef MEAS__TIME_MASTER_LOCK
|
|
Me@65
|
259 Histogram *masterLockLowTimeHist;
|
|
Me@65
|
260 Histogram *masterLockHighTimeHist;
|
|
Me@65
|
261 #endif
|
|
Me@42
|
262 }
|
|
Me@42
|
263 MasterEnv;
|
|
Me@42
|
264
|
|
Me@55
|
265 //========================= Extra Stuff Data Strucs =======================
|
|
Me@54
|
266 typedef struct
|
|
Me@54
|
267 {
|
|
Me@42
|
268
|
|
Me@54
|
269 }
|
|
Me@54
|
270 VMSExcp;
|
|
Me@50
|
271
|
|
Me@55
|
272 struct _GateStruc
|
|
Me@55
|
273 {
|
|
Me@55
|
274 int32 gateClosed;
|
|
Me@55
|
275 int32 preGateProgress;
|
|
Me@55
|
276 int32 waitProgress;
|
|
Me@55
|
277 int32 exitProgress;
|
|
Me@55
|
278 };
|
|
Me@55
|
279 //GateStruc
|
|
Me@50
|
280
|
|
Me@50
|
281 //======================= OS Thread related ===============================
|
|
Me@42
|
282
|
|
msach@70
|
283 void coreLoop( void *paramsIn ); //standard PThreads fn prototype
|
|
Me@42
|
284 void * coreLoop_Seq( void *paramsIn ); //standard PThreads fn prototype
|
|
msach@70
|
285 void terminateCoreLoop(VirtProcr *currPr);
|
|
Me@42
|
286 void masterLoop( void *initData, VirtProcr *masterPr );
|
|
Me@42
|
287
|
|
Me@50
|
288 typedef struct
|
|
Me@50
|
289 {
|
|
Me@50
|
290 void *endThdPt;
|
|
Me@50
|
291 unsigned int coreNum;
|
|
Me@50
|
292 }
|
|
Me@50
|
293 ThdParams;
|
|
Me@42
|
294
|
|
Me@42
|
295 pthread_t coreLoopThdHandles[ NUM_CORES ]; //pthread's virt-procr state
|
|
Me@42
|
296 ThdParams *coreLoopThdParams [ NUM_CORES ];
|
|
Me@42
|
297 pthread_mutex_t suspendLock;
|
|
Me@42
|
298 pthread_cond_t suspend_cond;
|
|
Me@42
|
299
|
|
Me@50
|
300
|
|
Me@50
|
301 //===================== Global Vars ===================
|
|
Me@50
|
302
|
|
Me@42
|
303 volatile MasterEnv *_VMSMasterEnv;
|
|
Me@42
|
304
|
|
Me@50
|
305
|
|
Me@50
|
306
|
|
Me@50
|
307
|
|
Me@50
|
308 //=========================== Function Prototypes =========================
|
|
Me@50
|
309
|
|
Me@53
|
310
|
|
Me@53
|
311 //========== Setup and shutdown ==========
|
|
Me@42
|
312 void
|
|
Me@42
|
313 VMS__init();
|
|
Me@42
|
314
|
|
Me@42
|
315 void
|
|
Me@42
|
316 VMS__init_Seq();
|
|
Me@42
|
317
|
|
Me@42
|
318 void
|
|
Me@42
|
319 VMS__start_the_work_then_wait_until_done();
|
|
Me@42
|
320
|
|
Me@42
|
321 void
|
|
Me@42
|
322 VMS__start_the_work_then_wait_until_done_Seq();
|
|
Me@42
|
323
|
|
Me@42
|
324 VirtProcr *
|
|
Me@42
|
325 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
|
|
Me@42
|
326
|
|
Me@53
|
327 void
|
|
Me@53
|
328 VMS__dissipate_procr( VirtProcr *procrToDissipate );
|
|
Me@53
|
329
|
|
Me@50
|
330 //Use this to create processor inside entry point & other places outside
|
|
Me@50
|
331 // the VMS system boundary (IE, not run in slave nor Master)
|
|
Me@50
|
332 VirtProcr *
|
|
Me@50
|
333 VMS_ext__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
|
|
Me@50
|
334
|
|
Me@53
|
335 void
|
|
Me@53
|
336 VMS_ext__dissipate_procr( VirtProcr *procrToDissipate );
|
|
Me@42
|
337
|
|
Me@50
|
338 void
|
|
Me@54
|
339 VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData );
|
|
Me@54
|
340
|
|
Me@54
|
341 void
|
|
Me@53
|
342 VMS__shutdown();
|
|
Me@53
|
343
|
|
Me@53
|
344 void
|
|
Me@53
|
345 VMS__cleanup_at_end_of_shutdown();
|
|
Me@50
|
346
|
|
Me@64
|
347 void *
|
|
Me@64
|
348 VMS__give_sem_env_for( VirtProcr *animPr );
|
|
Me@64
|
349
|
|
Me@50
|
350
|
|
Me@50
|
351 //============== Request Related ===============
|
|
Me@50
|
352
|
|
Me@50
|
353 void
|
|
Me@50
|
354 VMS__suspend_procr( VirtProcr *callingPr );
|
|
Me@50
|
355
|
|
Me@42
|
356 inline void
|
|
Me@53
|
357 VMS__add_sem_request_in_mallocd_VMSReqst( void *semReqData, VirtProcr *callingPr );
|
|
Me@53
|
358
|
|
Me@53
|
359 inline void
|
|
Me@53
|
360 VMS__send_sem_request( void *semReqData, VirtProcr *callingPr );
|
|
Me@42
|
361
|
|
Me@42
|
362 void
|
|
Me@50
|
363 VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr );
|
|
Me@42
|
364
|
|
Me@53
|
365 void inline
|
|
Me@53
|
366 VMS__send_dissipate_req( VirtProcr *prToDissipate );
|
|
Me@53
|
367
|
|
Me@52
|
368 inline void
|
|
Me@52
|
369 VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr );
|
|
Me@52
|
370
|
|
Me@42
|
371 VMSReqst *
|
|
Me@50
|
372 VMS__take_next_request_out_of( VirtProcr *procrWithReq );
|
|
Me@42
|
373
|
|
Me@42
|
374 inline void *
|
|
Me@42
|
375 VMS__take_sem_reqst_from( VMSReqst *req );
|
|
Me@42
|
376
|
|
Me@53
|
377 //======================== STATS ======================
|
|
Me@42
|
378
|
|
Me@53
|
379 //===== RDTSC wrapper =====
|
|
Me@42
|
380
|
|
Me@42
|
381 #define saveTimeStampCountInto(low, high) \
|
|
Me@42
|
382 asm volatile("RDTSC; \
|
|
Me@42
|
383 movl %%eax, %0; \
|
|
Me@42
|
384 movl %%edx, %1;" \
|
|
Me@42
|
385 /* outputs */ : "=m" (low), "=m" (high)\
|
|
Me@42
|
386 /* inputs */ : \
|
|
Me@42
|
387 /* clobber */ : "%eax", "%edx" \
|
|
Me@42
|
388 );
|
|
Me@42
|
389
|
|
Me@42
|
390 #define saveLowTimeStampCountInto(low) \
|
|
Me@42
|
391 asm volatile("RDTSC; \
|
|
Me@42
|
392 movl %%eax, %0;" \
|
|
Me@42
|
393 /* outputs */ : "=m" (low) \
|
|
Me@42
|
394 /* inputs */ : \
|
|
Me@42
|
395 /* clobber */ : "%eax", "%edx" \
|
|
Me@42
|
396 );
|
|
Me@68
|
397
|
|
Me@68
|
398 //====================
|
|
Me@68
|
399 #define makeAMeasHist( idx, name, numBins, startVal, binWidth ) \
|
|
Me@68
|
400 makeHighestDynArrayIndexBeAtLeast( _VMSMasterEnv->measHistsInfo, idx ); \
|
|
Me@68
|
401 _VMSMasterEnv->measHists[idx] = \
|
|
Me@68
|
402 makeFixedBinHist( numBins, startVal, binWidth, name );
|
|
Me@68
|
403
|
|
Me@68
|
404
|
|
Me@68
|
405 #define MEAS__SUB_CREATE /*turn on/off subtraction of create from plugin*/
|
|
msach@69
|
406
|
|
msach@69
|
407 //VPThread
|
|
Me@68
|
408 #define createHistIdx 1
|
|
Me@68
|
409 #define mutexLockHistIdx 2
|
|
Me@68
|
410 #define mutexUnlockHistIdx 3
|
|
Me@68
|
411 #define condWaitHistIdx 4
|
|
Me@68
|
412 #define condSignalHistIdx 5
|
|
Me@68
|
413
|
|
msach@69
|
414 //VCilk
|
|
msach@69
|
415 #define spawnHistIdx 1
|
|
msach@69
|
416 #define syncHistIdx 2
|
|
msach@69
|
417
|
|
msach@69
|
418 //SSR
|
|
msach@69
|
419 #define SendFromToHistIdx 1
|
|
msach@69
|
420 #define SendOfTypeHistIdx 2
|
|
msach@69
|
421 #define ReceiveFromToHistIdx 3
|
|
msach@69
|
422 #define ReceiveOfTypeHistIdx 4
|
|
msach@69
|
423
|
|
Me@68
|
424
|
|
Me@68
|
425 #define MakeTheMeasHists \
|
|
Me@68
|
426 _VMSMasterEnv->measHistsInfo = \
|
|
msach@69
|
427 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200);\
|
|
msach@69
|
428 makeAMeasHist( spawnHistIdx, "Spawn", 50, 0, 200 ) \
|
|
msach@69
|
429 makeAMeasHist( syncHistIdx, "Sync", 50, 0, 200 )
|
|
msach@69
|
430
|
|
msach@69
|
431 // makeAMeasHist( createHistIdx, "Create", 50, 0, 100 ) \
|
|
msach@69
|
432 // makeAMeasHist( mutexLockHistIdx, "mutex lock", 50, 0, 100 ) \
|
|
msach@69
|
433 // makeAMeasHist( mutexUnlockHistIdx, "mutex unlock", 50, 0, 100 ) \
|
|
msach@69
|
434 // makeAMeasHist( condWaitHistIdx, "cond wait", 50, 0, 100 ) \
|
|
msach@69
|
435 // makeAMeasHist( condSignalHistIdx, "cond signal", 50, 0, 100 )
|
|
msach@69
|
436
|
|
msach@69
|
437 // makeAMeasHist( SendFromToHistIdx, "SendFromTo", 50, 0, 100 ) \
|
|
msach@69
|
438 // makeAMeasHist( SendOfTypeHistIdx, "SendOfType", 50, 0, 100 ) \
|
|
msach@69
|
439 // makeAMeasHist( ReceiveFromToHistIdx,"ReceiveFromTo", 50, 0, 100 ) \
|
|
msach@69
|
440 // makeAMeasHist( ReceiveOfTypeHistIdx,"ReceiveOfType", 50, 0, 100 )
|
|
msach@69
|
441
|
|
msach@69
|
442
|
|
msach@69
|
443 //===========================================================================
|
|
msach@69
|
444 //VPThread
|
|
msach@69
|
445
|
|
Me@68
|
446
|
|
Me@68
|
447 #define Meas_startCreate \
|
|
Me@68
|
448 int32 startStamp, endStamp; \
|
|
Me@68
|
449 saveLowTimeStampCountInto( startStamp ); \
|
|
Me@68
|
450
|
|
Me@68
|
451 #define Meas_endCreate \
|
|
Me@68
|
452 saveLowTimeStampCountInto( endStamp ); \
|
|
Me@68
|
453 addIntervalToHist( startStamp, endStamp, \
|
|
Me@68
|
454 _VMSMasterEnv->measHists[ createHistIdx ] );
|
|
Me@68
|
455
|
|
Me@68
|
456 #define Meas_startMutexLock \
|
|
Me@68
|
457 int32 startStamp, endStamp; \
|
|
Me@68
|
458 saveLowTimeStampCountInto( startStamp ); \
|
|
Me@68
|
459
|
|
Me@68
|
460 #define Meas_endMutexLock \
|
|
Me@68
|
461 saveLowTimeStampCountInto( endStamp ); \
|
|
Me@68
|
462 addIntervalToHist( startStamp, endStamp, \
|
|
Me@68
|
463 _VMSMasterEnv->measHists[ mutexLockHistIdx ] );
|
|
Me@68
|
464
|
|
Me@68
|
465 #define Meas_startMutexUnlock \
|
|
Me@68
|
466 int32 startStamp, endStamp; \
|
|
Me@68
|
467 saveLowTimeStampCountInto( startStamp ); \
|
|
Me@68
|
468
|
|
Me@68
|
469 #define Meas_endMutexUnlock \
|
|
Me@68
|
470 saveLowTimeStampCountInto( endStamp ); \
|
|
Me@68
|
471 addIntervalToHist( startStamp, endStamp, \
|
|
Me@68
|
472 _VMSMasterEnv->measHists[ mutexUnlockHistIdx ] );
|
|
Me@68
|
473
|
|
Me@68
|
474 #define Meas_startCondWait \
|
|
Me@68
|
475 int32 startStamp, endStamp; \
|
|
Me@68
|
476 saveLowTimeStampCountInto( startStamp ); \
|
|
Me@68
|
477
|
|
Me@68
|
478 #define Meas_endCondWait \
|
|
Me@68
|
479 saveLowTimeStampCountInto( endStamp ); \
|
|
Me@68
|
480 addIntervalToHist( startStamp, endStamp, \
|
|
Me@68
|
481 _VMSMasterEnv->measHists[ condWaitHistIdx ] );
|
|
Me@68
|
482
|
|
Me@68
|
483 #define Meas_startCondSignal \
|
|
Me@68
|
484 int32 startStamp, endStamp; \
|
|
Me@68
|
485 saveLowTimeStampCountInto( startStamp ); \
|
|
Me@68
|
486
|
|
Me@68
|
487 #define Meas_endCondSignal \
|
|
Me@68
|
488 saveLowTimeStampCountInto( endStamp ); \
|
|
Me@68
|
489 addIntervalToHist( startStamp, endStamp, \
|
|
Me@68
|
490 _VMSMasterEnv->measHists[ condSignalHistIdx ] );
|
|
Me@68
|
491
|
|
msach@69
|
492 //===========================================================================
|
|
msach@69
|
493 // VCilk
|
|
msach@69
|
494 #define Meas_startSpawn \
|
|
msach@69
|
495 int32 startStamp, endStamp; \
|
|
msach@69
|
496 saveLowTimeStampCountInto( startStamp ); \
|
|
msach@69
|
497
|
|
msach@69
|
498 #define Meas_endSpawn \
|
|
msach@69
|
499 saveLowTimeStampCountInto( endStamp ); \
|
|
msach@69
|
500 addIntervalToHist( startStamp, endStamp, \
|
|
msach@69
|
501 _VMSMasterEnv->measHists[ spawnHistIdx ] );
|
|
msach@69
|
502
|
|
msach@69
|
503 #define Meas_startSync \
|
|
msach@69
|
504 int32 startStamp, endStamp; \
|
|
msach@69
|
505 saveLowTimeStampCountInto( startStamp ); \
|
|
msach@69
|
506
|
|
msach@69
|
507 #define Meas_endSync \
|
|
msach@69
|
508 saveLowTimeStampCountInto( endStamp ); \
|
|
msach@69
|
509 addIntervalToHist( startStamp, endStamp, \
|
|
msach@69
|
510 _VMSMasterEnv->measHists[ syncHistIdx ] );
|
|
msach@69
|
511
|
|
msach@69
|
512 //===========================================================================
|
|
msach@69
|
513 // SSR
|
|
msach@69
|
514 #define Meas_startSendFromTo \
|
|
msach@69
|
515 int32 startStamp, endStamp; \
|
|
msach@69
|
516 saveLowTimeStampCountInto( startStamp ); \
|
|
msach@69
|
517
|
|
msach@69
|
518 #define Meas_endSendFromTo \
|
|
msach@69
|
519 saveLowTimeStampCountInto( endStamp ); \
|
|
msach@69
|
520 addIntervalToHist( startStamp, endStamp, \
|
|
msach@69
|
521 _VMSMasterEnv->measHists[ SendFromToHistIdx ] );
|
|
msach@69
|
522
|
|
msach@69
|
523 #define Meas_startSendOfType \
|
|
msach@69
|
524 int32 startStamp, endStamp; \
|
|
msach@69
|
525 saveLowTimeStampCountInto( startStamp ); \
|
|
msach@69
|
526
|
|
msach@69
|
527 #define Meas_endSendOfType \
|
|
msach@69
|
528 saveLowTimeStampCountInto( endStamp ); \
|
|
msach@69
|
529 addIntervalToHist( startStamp, endStamp, \
|
|
msach@69
|
530 _VMSMasterEnv->measHists[ SendOfTypeHistIdx ] );
|
|
msach@69
|
531
|
|
msach@69
|
532 #define Meas_startReceiveFromTo \
|
|
msach@69
|
533 int32 startStamp, endStamp; \
|
|
msach@69
|
534 saveLowTimeStampCountInto( startStamp ); \
|
|
msach@69
|
535
|
|
msach@69
|
536 #define Meas_endReceiveFromTo \
|
|
msach@69
|
537 saveLowTimeStampCountInto( endStamp ); \
|
|
msach@69
|
538 addIntervalToHist( startStamp, endStamp, \
|
|
msach@69
|
539 _VMSMasterEnv->measHists[ ReceiveFromToHistIdx ] );
|
|
msach@69
|
540
|
|
msach@69
|
541 #define Meas_startReceiveOfType \
|
|
msach@69
|
542 int32 startStamp, endStamp; \
|
|
msach@69
|
543 saveLowTimeStampCountInto( startStamp ); \
|
|
msach@69
|
544
|
|
msach@69
|
545 #define Meas_endReceiveOfType \
|
|
msach@69
|
546 saveLowTimeStampCountInto( endStamp ); \
|
|
msach@69
|
547 addIntervalToHist( startStamp, endStamp, \
|
|
msach@69
|
548 _VMSMasterEnv->measHists[ReceiveOfTypeHistIdx ] );
|
|
Me@68
|
549
|
|
Me@53
|
550 //=====
|
|
Me@42
|
551
|
|
msach@70
|
552 //======= Utilities ======
|
|
msach@70
|
553 /*
|
|
msach@70
|
554 * This Macro makes the gcc reload all variables from Stack after this function.
|
|
msach@70
|
555 * This is necessary because we jmp into the masterLoop and the variables are
|
|
msach@70
|
556 * kept in Registers for optimization.
|
|
msach@70
|
557 */
|
|
msach@70
|
558 #define flushRegisters() \
|
|
msach@70
|
559 asm volatile ("" /*no instr needed*/ \
|
|
msach@70
|
560 ::: /*no output and input*/ \
|
|
msach@70
|
561 "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi")
|
|
msach@70
|
562 //========
|
|
msach@70
|
563
|
|
Me@55
|
564 #include "SwitchAnimators.h"
|
|
Me@50
|
565 #include "probes.h"
|
|
Me@65
|
566 #include "vutilities.h"
|
|
Me@42
|
567
|
|
Me@42
|
568 #endif /* _VMS_H */
|
|
Me@42
|
569
|