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