annotate VMS.h @ 120:d4c881c7f03a

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