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