annotate VMS.h @ 127:24466227d8bb

bugs fixed, code is now compiling
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 07 Sep 2011 17:45:05 +0200
parents d4c881c7f03a
children dbfc8382d546
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@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@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@79 96 #define PAGE_SIZE 4096
msach@78 97
Me@50 98
Me@50 99 //==============================
Me@42 100
Me@42 101 #define SUCCESS 0
Me@42 102
Me@55 103 #define writeVMSQ writePrivQ
Me@55 104 #define readVMSQ readPrivQ
Me@64 105 #define makeVMSQ makeVMSPrivQ
Me@55 106 #define numInVMSQ numInPrivQ
Me@55 107 #define VMSQueueStruc PrivQueueStruc
Me@42 108
Me@42 109
Me@50 110
Me@50 111 //===========================================================================
Me@50 112 typedef unsigned long long TSCount;
Me@50 113
Me@50 114 typedef struct _SchedSlot SchedSlot;
Me@50 115 typedef struct _VMSReqst VMSReqst;
msach@127 116 typedef struct _VirtProcr VirtProcr;
Me@120 117 typedef struct _InterMasterReqst InterMasterReqst;
Me@50 118 typedef struct _IntervalProbe IntervalProbe;
Me@55 119 typedef struct _GateStruc GateStruc;
Me@55 120
Me@42 121
Me@42 122 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx
Me@42 123 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv
Me@42 124 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr
Me@42 125 typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr
Me@50 126 typedef void (*ResumePrFnPtr) ( VirtProcr *, void * );
Me@50 127
Me@50 128
Me@50 129 //============= Requests ===========
Me@50 130 //
Me@50 131
Me@120 132 //VMS Request is the carrier for Slave to Master requests
Me@120 133 // it has an embedded sub-type request that is pulled out
Me@120 134 // inside the plugin's request handler
Me@120 135 enum VMSReqstType //For Slave->Master requests
Me@120 136 {
Me@120 137 semantic = 1, //avoid starting enums at 0, for debug reasons
Me@50 138 createReq,
Me@50 139 dissipate,
Me@50 140 VMSSemantic //goes with VMSSemReqst below
Me@50 141 };
Me@50 142
Me@50 143 struct _VMSReqst
Me@50 144 {
Me@50 145 enum VMSReqstType reqType;//used for dissipate and in future for IO requests
Me@50 146 void *semReqData;
Me@50 147
Me@50 148 VMSReqst *nextReqst;
Me@50 149 };
Me@50 150 //VMSReqst
Me@50 151
Me@120 152 //This is a sub-type of Slave->Master requests.
Me@120 153 // It's for Slaves to invoke built-in VMS-core functions that have language-like
Me@120 154 // behavior.
Me@50 155 enum VMSSemReqstType //These are equivalent to semantic requests, but for
Me@50 156 { // VMS's services available directly to app, like OS
Me@50 157 createProbe = 1, // and probe services -- like a VMS-wide built-in lang
Me@50 158 openFile,
Me@50 159 otherIO
Me@50 160 };
Me@42 161
Me@42 162 typedef struct
Me@50 163 { enum VMSSemReqstType reqType;
Me@50 164 VirtProcr *requestingPr;
Me@50 165 char *nameStr; //for create probe
Me@42 166 }
Me@120 167 VMSSemReq;
Me@120 168
Me@120 169 //These are for Master to Master requests
Me@120 170 // They get re-cast to the appropriate sub-type of request
Me@120 171 enum InterMasterReqstType //For Master->Master
Me@120 172 {
Me@120 173 destVMSCore = 1, //avoid starting enums at 0, for debug reasons
Me@120 174 destPlugin
Me@120 175 };
Me@120 176
Me@120 177 struct _InterMasterReqst //Doing a trick to save space & time -- allocate
Me@120 178 { // space for a sub-type then cast first as InterMaster then as sub-type
Me@120 179 enum InterMasterReqstType reqType;
Me@120 180 InterMasterReqst *nextReqst;
Me@120 181 };
Me@120 182 //InterMasterReqst (defined above in typedef block)
Me@120 183
Me@120 184
Me@120 185 //These are a sub-type of InterMaster requests. The inter-master req gets
Me@120 186 // re-cast to be of this type, after checking
Me@120 187 //This ones for requests between internals of VMS-core.. such as malloc
Me@120 188 enum InterVMSCoreReqType
Me@120 189 {
Me@120 190 transfer_free_ptr = 1 //avoid starting enums at 0, for debug reasons
Me@120 191 };
Me@120 192
msach@127 193 //Doing a trick to save space & time -- allocate space
msach@127 194 // for this, cast first as InterMaster then as this
msach@127 195 typedef struct
msach@127 196 {
Me@120 197 enum InterMasterReqstType reqType; //duplicate InterMasterReqst at top
Me@120 198 InterMasterReqst *nextReqst;
Me@120 199
Me@120 200 enum InterVMSCoreReqType secondReqType;
Me@120 201 void *freePtr; //pile up fields, add as needed
msach@127 202 } InterVMSCoreReqst;
Me@120 203
Me@120 204 //This is for requests between plugins on different cores
Me@120 205 // Here, after casting, the pluginReq is extracted and handed to plugin
msach@127 206 //Doing a trick to save space & time -- allocate space
msach@127 207 // for this, cast first as InterMaster then as this
msach@127 208 typedef struct
msach@127 209 {
Me@120 210 enum InterMasterReqstType reqType; //copy InterMasterReqst at top
Me@120 211 InterMasterReqst *nextReqst;
Me@120 212
Me@120 213 void *pluginReq; //plugin will cast to approp type
msach@127 214 } InterPluginReqst;
Me@42 215
Me@50 216 //==================== Core data structures ===================
Me@50 217
Me@42 218 struct _SchedSlot
Me@42 219 {
Me@42 220 int workIsDone;
Me@42 221 int needsProcrAssigned;
Me@42 222 VirtProcr *procrAssignedToSlot;
Me@42 223 };
Me@42 224 //SchedSlot
Me@42 225
Me@62 226 /*WARNING: re-arranging this data structure could cause VP switching
Me@64 227 * assembly code to fail -- hard-codes offsets of fields
Me@62 228 */
Me@42 229 struct _VirtProcr
Me@42 230 { int procrID; //for debugging -- count up each time create
Me@42 231 int coreAnimatedBy;
Me@42 232 void *startOfStack;
msach@69 233 void *stackPtr;
msach@69 234 void *framePtr;
msach@69 235 void *nextInstrPt;
Me@42 236
msach@69 237 void *coreLoopStartPt; //allows proto-runtime to be linked later
msach@69 238 void *coreLoopFramePtr; //restore before jmp back to core loop
msach@69 239 void *coreLoopStackPtr; //restore before jmp back to core loop
Me@42 240
Me@42 241 void *initialData;
Me@42 242
Me@42 243 SchedSlot *schedSlot;
Me@42 244 VMSReqst *requests;
Me@42 245
msach@76 246 void *semanticData; //this livesUSE_GNU here for the life of VP
Me@53 247 void *dataRetFromReq;//values returned from plugin to VP go here
Me@42 248
Me@50 249 //=========== MEASUREMENT STUFF ==========
Me@42 250 #ifdef MEAS__TIME_STAMP_SUSP
Me@42 251 unsigned int preSuspTSCLow;
Me@42 252 unsigned int postSuspTSCLow;
Me@42 253 #endif
Me@65 254 #ifdef MEAS__TIME_MASTER /* in VirtProcr because multiple masterVPs*/
msach@76 255 unsigned int startMasterTSCLow;USE_GNU
Me@42 256 unsigned int endMasterTSCLow;
Me@42 257 #endif
Me@65 258 //========================================
Me@50 259
Me@50 260 float64 createPtInSecs; //have space but don't use on some configs
Me@42 261 };
Me@42 262 //VirtProcr
Me@42 263
Me@42 264
Me@120 265 /*Master Env is the only global variable -- has entry points for any other
Me@120 266 * data needed.
Me@62 267 */
Me@42 268 typedef struct
Me@42 269 {
Me@42 270 SlaveScheduler slaveScheduler;
Me@42 271 RequestHandler requestHandler;
Me@42 272
Me@42 273 SchedSlot ***allSchedSlots;
msach@127 274 VMSQueueStruc **readyToAnimateQs;
Me@42 275 VirtProcr **masterVPs;
Me@42 276
Me@42 277 void *semanticEnv;
Me@42 278 void *OSEventStruc; //for future, when add I/O to BLIS
Me@50 279 MallocProlog *freeListHead;
Me@50 280 int32 amtOfOutstandingMem; //total currently allocated
Me@42 281
msach@73 282 void *coreLoopReturnPt;//addr to jump to to re-enter coreLoop
Me@42 283
Me@50 284 int32 setupComplete;
msach@71 285 volatile int32 masterLock;
Me@42 286
Me@50 287 int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP
Me@59 288 GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal
Me@55 289 int32 workStealingLock;
Me@55 290
msach@127 291 InterMasterReqst* interMasterRequestsFor[NUM_CORES];
msach@127 292 RequestHandler interPluginReqHdlr;
msach@127 293
msach@127 294 int32 numProcrsCreated; //gives ordering to processor creation
Me@50 295
Me@50 296 //=========== MEASUREMENT STUFF =============
msach@127 297 IntervalProbe **intervalProbes;
msach@127 298 PrivDynArrayInfo *dynIntervalProbesInfo;
msach@127 299 HashTable *probeNameHashTbl;
msach@127 300 int32 masterCreateProbeID;
msach@127 301 float64 createPtInSecs;
msach@127 302 Histogram **measHists;
msach@127 303 PrivDynArrayInfo *measHistsInfo;
Me@65 304 #ifdef MEAS__TIME_PLUGIN
msach@127 305 Histogram *reqHdlrLowTimeHist;
msach@127 306 Histogram *reqHdlrHighTimeHist;
Me@65 307 #endif
Me@65 308 #ifdef MEAS__TIME_MALLOC
msach@127 309 Histogram *mallocTimeHist;
msach@127 310 Histogram *freeTimeHist;
Me@65 311 #endif
Me@65 312 #ifdef MEAS__TIME_MASTER_LOCK
msach@127 313 Histogram *masterLockLowTimeHist;
msach@127 314 Histogram *masterLockHighTimeHist;
Me@65 315 #endif
Me@42 316 }
Me@42 317 MasterEnv;
Me@42 318
Me@55 319 //========================= Extra Stuff Data Strucs =======================
Me@54 320 typedef struct
Me@54 321 {
Me@42 322
Me@54 323 }
Me@54 324 VMSExcp;
Me@50 325
Me@55 326 struct _GateStruc
Me@55 327 {
Me@55 328 int32 gateClosed;
Me@55 329 int32 preGateProgress;
Me@55 330 int32 waitProgress;
Me@55 331 int32 exitProgress;
Me@55 332 };
Me@55 333 //GateStruc
Me@50 334
Me@50 335 //======================= OS Thread related ===============================
Me@42 336
msach@69 337 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype
Me@42 338 void * coreLoop_Seq( void *paramsIn ); //standard PThreads fn prototype
Me@42 339 void masterLoop( void *initData, VirtProcr *masterPr );
Me@42 340
msach@69 341
Me@50 342 typedef struct
Me@50 343 {
Me@50 344 void *endThdPt;
Me@50 345 unsigned int coreNum;
Me@50 346 }
Me@50 347 ThdParams;
Me@42 348
Me@42 349 pthread_t coreLoopThdHandles[ NUM_CORES ]; //pthread's virt-procr state
Me@42 350 ThdParams *coreLoopThdParams [ NUM_CORES ];
Me@42 351 pthread_mutex_t suspendLock;
Me@42 352 pthread_cond_t suspend_cond;
Me@42 353
Me@50 354
msach@69 355
Me@50 356 //===================== Global Vars ===================
Me@50 357
Me@42 358 volatile MasterEnv *_VMSMasterEnv;
Me@42 359
Me@50 360
Me@50 361
Me@50 362
Me@50 363 //=========================== Function Prototypes =========================
Me@50 364
Me@53 365
Me@53 366 //========== Setup and shutdown ==========
Me@42 367 void
Me@42 368 VMS__init();
Me@42 369
Me@42 370 void
Me@42 371 VMS__init_Seq();
Me@42 372
Me@42 373 void
Me@42 374 VMS__start_the_work_then_wait_until_done();
Me@42 375
Me@42 376 void
Me@42 377 VMS__start_the_work_then_wait_until_done_Seq();
Me@42 378
msach@76 379 inline VirtProcr *
Me@42 380 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
Me@42 381
Me@53 382 void
Me@53 383 VMS__dissipate_procr( VirtProcr *procrToDissipate );
Me@53 384
Me@50 385 //Use this to create processor inside entry point & other places outside
Me@50 386 // the VMS system boundary (IE, not run in slave nor Master)
Me@50 387 VirtProcr *
Me@50 388 VMS_ext__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
Me@50 389
Me@53 390 void
Me@53 391 VMS_ext__dissipate_procr( VirtProcr *procrToDissipate );
Me@42 392
Me@50 393 void
Me@54 394 VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData );
Me@54 395
Me@54 396 void
Me@53 397 VMS__shutdown();
Me@53 398
Me@53 399 void
Me@53 400 VMS__cleanup_at_end_of_shutdown();
Me@50 401
Me@64 402 void *
Me@64 403 VMS__give_sem_env_for( VirtProcr *animPr );
Me@64 404
Me@50 405
Me@50 406 //============== Request Related ===============
Me@50 407
Me@50 408 void
Me@50 409 VMS__suspend_procr( VirtProcr *callingPr );
Me@50 410
Me@42 411 inline void
Me@53 412 VMS__add_sem_request_in_mallocd_VMSReqst( void *semReqData, VirtProcr *callingPr );
Me@53 413
Me@53 414 inline void
Me@53 415 VMS__send_sem_request( void *semReqData, VirtProcr *callingPr );
Me@42 416
Me@42 417 void
Me@50 418 VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr );
Me@42 419
Me@53 420 void inline
Me@53 421 VMS__send_dissipate_req( VirtProcr *prToDissipate );
Me@53 422
Me@52 423 inline void
Me@52 424 VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr );
Me@52 425
Me@120 426
Me@120 427 void inline
Me@120 428 VMS__send_inter_plugin_req( void *reqData, int32 targetMaster,
Me@120 429 VirtProcr *requestingMaster );
Me@120 430 void inline
Me@120 431 VMS__send_inter_VMSCore_req( InterVMSCoreReqst *reqData, int32 targetMaster,
Me@120 432 VirtProcr *requestingMaster );
Me@120 433
Me@42 434 VMSReqst *
Me@50 435 VMS__take_next_request_out_of( VirtProcr *procrWithReq );
Me@42 436
Me@42 437 inline void *
Me@42 438 VMS__take_sem_reqst_from( VMSReqst *req );
Me@42 439
msach@78 440 void inline
msach@78 441 VMS__handle_VMSSemReq( VMSReqst *req, VirtProcr *requestingPr, void *semEnv,
msach@78 442 ResumePrFnPtr resumePrFnPtr );
msach@78 443
Me@53 444 //======================== STATS ======================
Me@42 445
msach@76 446 //===== RDTSC wrapper ===== //Also runs with x86_64 code
Me@42 447
Me@42 448 #define saveTimeStampCountInto(low, high) \
Me@42 449 asm volatile("RDTSC; \
Me@42 450 movl %%eax, %0; \
Me@42 451 movl %%edx, %1;" \
Me@42 452 /* outputs */ : "=m" (low), "=m" (high)\
Me@42 453 /* inputs */ : \
Me@42 454 /* clobber */ : "%eax", "%edx" \
Me@42 455 );
Me@42 456
Me@42 457 #define saveLowTimeStampCountInto(low) \
Me@42 458 asm volatile("RDTSC; \
Me@42 459 movl %%eax, %0;" \
Me@42 460 /* outputs */ : "=m" (low) \
Me@42 461 /* inputs */ : \
Me@42 462 /* clobber */ : "%eax", "%edx" \
Me@42 463 );
Me@68 464
Me@68 465 //====================
Me@68 466 #define makeAMeasHist( idx, name, numBins, startVal, binWidth ) \
Me@68 467 makeHighestDynArrayIndexBeAtLeast( _VMSMasterEnv->measHistsInfo, idx ); \
Me@68 468 _VMSMasterEnv->measHists[idx] = \
Me@68 469 makeFixedBinHist( numBins, startVal, binWidth, name );
Me@68 470
Me@68 471
Me@68 472 #define MEAS__SUB_CREATE /*turn on/off subtraction of create from plugin*/
msach@69 473
msach@73 474 #ifdef VPTHREAD
msach@73 475
msach@69 476 //VPThread
Me@68 477 #define createHistIdx 1
Me@68 478 #define mutexLockHistIdx 2
Me@68 479 #define mutexUnlockHistIdx 3
Me@68 480 #define condWaitHistIdx 4
Me@68 481 #define condSignalHistIdx 5
Me@68 482
msach@76 483 #define MakeTheMeasHists() \
msach@73 484 _VMSMasterEnv->measHistsInfo = \
msach@73 485 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \
msach@84 486 makeAMeasHist( createHistIdx, "create", 250, 0, 100 ) \
msach@78 487 makeAMeasHist( mutexLockHistIdx, "mutex_lock", 50, 0, 100 ) \
msach@78 488 makeAMeasHist( mutexUnlockHistIdx, "mutex_unlock", 50, 0, 100 ) \
msach@78 489 makeAMeasHist( condWaitHistIdx, "cond_wait", 50, 0, 100 ) \
msach@78 490 makeAMeasHist( condSignalHistIdx, "cond_signal", 50, 0, 100 )
msach@73 491
msach@73 492 #endif
msach@73 493
msach@73 494
msach@73 495 #ifdef VCILK
msach@73 496
msach@69 497 //VCilk
msach@69 498 #define spawnHistIdx 1
msach@69 499 #define syncHistIdx 2
msach@69 500
msach@76 501 #define MakeTheMeasHists() \
msach@73 502 _VMSMasterEnv->measHistsInfo = \
msach@73 503 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \
msach@73 504 makeAMeasHist( spawnHistIdx, "Spawn", 50, 0, 200 ) \
msach@73 505 makeAMeasHist( syncHistIdx, "Sync", 50, 0, 200 )
msach@73 506
msach@73 507
msach@73 508 #endif
msach@73 509
msach@73 510 #ifdef SSR
msach@73 511
msach@69 512 //SSR
msach@69 513 #define SendFromToHistIdx 1
msach@69 514 #define SendOfTypeHistIdx 2
msach@69 515 #define ReceiveFromToHistIdx 3
msach@69 516 #define ReceiveOfTypeHistIdx 4
msach@69 517
msach@76 518 #define MakeTheMeasHists() \
msach@69 519 _VMSMasterEnv->measHistsInfo = \
msach@73 520 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \
msach@73 521 makeAMeasHist( SendFromToHistIdx, "SendFromTo", 50, 0, 100 ) \
msach@73 522 makeAMeasHist( SendOfTypeHistIdx, "SendOfType", 50, 0, 100 ) \
msach@73 523 makeAMeasHist( ReceiveFromToHistIdx,"ReceiveFromTo", 50, 0, 100 ) \
msach@73 524 makeAMeasHist( ReceiveOfTypeHistIdx,"ReceiveOfType", 50, 0, 100 )
Me@68 525
msach@73 526 #endif
msach@69 527
msach@69 528 //===========================================================================
msach@69 529 //VPThread
msach@69 530
Me@68 531
Me@68 532 #define Meas_startCreate \
Me@68 533 int32 startStamp, endStamp; \
Me@68 534 saveLowTimeStampCountInto( startStamp ); \
Me@68 535
Me@68 536 #define Meas_endCreate \
Me@68 537 saveLowTimeStampCountInto( endStamp ); \
Me@68 538 addIntervalToHist( startStamp, endStamp, \
Me@68 539 _VMSMasterEnv->measHists[ createHistIdx ] );
Me@68 540
Me@68 541 #define Meas_startMutexLock \
Me@68 542 int32 startStamp, endStamp; \
Me@68 543 saveLowTimeStampCountInto( startStamp ); \
Me@68 544
Me@68 545 #define Meas_endMutexLock \
Me@68 546 saveLowTimeStampCountInto( endStamp ); \
Me@68 547 addIntervalToHist( startStamp, endStamp, \
Me@68 548 _VMSMasterEnv->measHists[ mutexLockHistIdx ] );
Me@68 549
Me@68 550 #define Meas_startMutexUnlock \
Me@68 551 int32 startStamp, endStamp; \
Me@68 552 saveLowTimeStampCountInto( startStamp ); \
Me@68 553
Me@68 554 #define Meas_endMutexUnlock \
Me@68 555 saveLowTimeStampCountInto( endStamp ); \
Me@68 556 addIntervalToHist( startStamp, endStamp, \
Me@68 557 _VMSMasterEnv->measHists[ mutexUnlockHistIdx ] );
Me@68 558
Me@68 559 #define Meas_startCondWait \
Me@68 560 int32 startStamp, endStamp; \
Me@68 561 saveLowTimeStampCountInto( startStamp ); \
Me@68 562
Me@68 563 #define Meas_endCondWait \
Me@68 564 saveLowTimeStampCountInto( endStamp ); \
Me@68 565 addIntervalToHist( startStamp, endStamp, \
Me@68 566 _VMSMasterEnv->measHists[ condWaitHistIdx ] );
Me@68 567
Me@68 568 #define Meas_startCondSignal \
Me@68 569 int32 startStamp, endStamp; \
Me@68 570 saveLowTimeStampCountInto( startStamp ); \
Me@68 571
Me@68 572 #define Meas_endCondSignal \
Me@68 573 saveLowTimeStampCountInto( endStamp ); \
Me@68 574 addIntervalToHist( startStamp, endStamp, \
Me@68 575 _VMSMasterEnv->measHists[ condSignalHistIdx ] );
Me@68 576
msach@69 577 //===========================================================================
msach@69 578 // VCilk
msach@69 579 #define Meas_startSpawn \
msach@69 580 int32 startStamp, endStamp; \
msach@69 581 saveLowTimeStampCountInto( startStamp ); \
msach@69 582
msach@69 583 #define Meas_endSpawn \
msach@69 584 saveLowTimeStampCountInto( endStamp ); \
msach@69 585 addIntervalToHist( startStamp, endStamp, \
msach@69 586 _VMSMasterEnv->measHists[ spawnHistIdx ] );
msach@69 587
msach@69 588 #define Meas_startSync \
msach@69 589 int32 startStamp, endStamp; \
msach@69 590 saveLowTimeStampCountInto( startStamp ); \
msach@69 591
msach@69 592 #define Meas_endSync \
msach@69 593 saveLowTimeStampCountInto( endStamp ); \
msach@69 594 addIntervalToHist( startStamp, endStamp, \
msach@69 595 _VMSMasterEnv->measHists[ syncHistIdx ] );
msach@69 596
msach@69 597 //===========================================================================
msach@69 598 // SSR
msach@69 599 #define Meas_startSendFromTo \
msach@69 600 int32 startStamp, endStamp; \
msach@69 601 saveLowTimeStampCountInto( startStamp ); \
msach@69 602
msach@69 603 #define Meas_endSendFromTo \
msach@69 604 saveLowTimeStampCountInto( endStamp ); \
msach@69 605 addIntervalToHist( startStamp, endStamp, \
msach@69 606 _VMSMasterEnv->measHists[ SendFromToHistIdx ] );
msach@69 607
msach@69 608 #define Meas_startSendOfType \
msach@69 609 int32 startStamp, endStamp; \
msach@69 610 saveLowTimeStampCountInto( startStamp ); \
msach@69 611
msach@69 612 #define Meas_endSendOfType \
msach@69 613 saveLowTimeStampCountInto( endStamp ); \
msach@69 614 addIntervalToHist( startStamp, endStamp, \
msach@69 615 _VMSMasterEnv->measHists[ SendOfTypeHistIdx ] );
msach@69 616
msach@69 617 #define Meas_startReceiveFromTo \
msach@69 618 int32 startStamp, endStamp; \
msach@69 619 saveLowTimeStampCountInto( startStamp ); \
msach@69 620
msach@69 621 #define Meas_endReceiveFromTo \
msach@69 622 saveLowTimeStampCountInto( endStamp ); \
msach@69 623 addIntervalToHist( startStamp, endStamp, \
msach@69 624 _VMSMasterEnv->measHists[ ReceiveFromToHistIdx ] );
msach@69 625
msach@69 626 #define Meas_startReceiveOfType \
msach@69 627 int32 startStamp, endStamp; \
msach@69 628 saveLowTimeStampCountInto( startStamp ); \
msach@69 629
msach@69 630 #define Meas_endReceiveOfType \
msach@69 631 saveLowTimeStampCountInto( endStamp ); \
msach@69 632 addIntervalToHist( startStamp, endStamp, \
msach@69 633 _VMSMasterEnv->measHists[ReceiveOfTypeHistIdx ] );
Me@68 634
Me@53 635 //=====
Me@42 636
msach@77 637 #include "ProcrContext.h"
Me@50 638 #include "probes.h"
Me@65 639 #include "vutilities.h"
Me@42 640
Me@42 641 #endif /* _VMS_H */
Me@42 642