annotate VMS.h @ 177:3bd35fc83c61

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