annotate VMS.h @ 193:20358f56e498

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