comparison VMS.h @ 68:9c3107044f86

Added measurement hists macros
author Me
date Sat, 20 Nov 2010 08:19:05 +0100
parents 2377967a2732
children 11bfe9d136ed a49f02980151
comparison
equal deleted inserted replaced
35:3a252813a11d 36:3dbb551a7aa7
35 #define STATS__ENABLE_PROBES 35 #define STATS__ENABLE_PROBES
36 //#define TURN_ON_DEBUG_PROBES 36 //#define TURN_ON_DEBUG_PROBES
37 37
38 //These defines turn types of bug messages on and off 38 //These defines turn types of bug messages on and off
39 // be sure debug messages are un-commented (next block of defines) 39 // be sure debug messages are un-commented (next block of defines)
40 #define dbgAppFlow TRUE /* Top level flow of application code -- general*/
40 #define dbgProbes FALSE /* for issues inside probes themselves*/ 41 #define dbgProbes FALSE /* for issues inside probes themselves*/
41 #define dbgAppFlow FALSE /* Top level flow of application code -- general*/
42 #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/ 42 #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/
43 #define dbgRqstHdlr FALSE /* in request handler code*/ 43 #define dbgRqstHdlr FALSE /* in request handler code*/
44 44
45 //Comment or un- the substitute half to turn on/off types of debug message 45 //Comment or un- the substitute half to turn on/off types of debug message
46 #define DEBUG( bool, msg) \ 46 #define DEBUG( bool, msg) \
47 // if( bool){ printf(msg); fflush(stdin);} 47 // if( bool){ printf(msg); fflush(stdin);}
48 #define DEBUG1( bool, msg, param) \ 48 #define DEBUG1( bool, msg, param) \
49 // if(bool){printf(msg, param); fflush(stdin);} 49 // if(bool){printf(msg, param); fflush(stdin);}
50 #define DEBUG2( bool, msg, p1, p2) \ 50 #define DEBUG2( bool, msg, p1, p2) \
51 // if(bool) {printf(msg, p1, p2); fflush(stdin);} 51 // if(bool) {printf(msg, p1, p2); fflush(stdin);}
52 52
63 // rollover of low portion into high portion. 63 // rollover of low portion into high portion.
64 //#define MEAS__TIME_STAMP_SUSP 64 //#define MEAS__TIME_STAMP_SUSP
65 //#define MEAS__TIME_MASTER 65 //#define MEAS__TIME_MASTER
66 #define MEAS__TIME_PLUGIN 66 #define MEAS__TIME_PLUGIN
67 #define MEAS__TIME_MALLOC 67 #define MEAS__TIME_MALLOC
68 #define MEAS__TIME_MASTER_LOCK 68 //#define MEAS__TIME_MASTER_LOCK
69 #define MEAS__NUM_TIMES_TO_RUN 100000 69 #define MEAS__NUM_TIMES_TO_RUN 100000
70 70
71 //For code that calculates normalization-offset between TSC counts of 71 //For code that calculates normalization-offset between TSC counts of
72 // different cores. 72 // different cores.
73 #define NUM_TSC_ROUND_TRIPS 10 73 #define NUM_TSC_ROUND_TRIPS 10
240 IntervalProbe **intervalProbes; 240 IntervalProbe **intervalProbes;
241 PrivDynArrayInfo *dynIntervalProbesInfo; 241 PrivDynArrayInfo *dynIntervalProbesInfo;
242 HashTable *probeNameHashTbl; 242 HashTable *probeNameHashTbl;
243 int32 masterCreateProbeID; 243 int32 masterCreateProbeID;
244 float64 createPtInSecs; 244 float64 createPtInSecs;
245 Histogram **measHists;
246 PrivDynArrayInfo *measHistsInfo;
245 #ifdef MEAS__TIME_PLUGIN 247 #ifdef MEAS__TIME_PLUGIN
246 Histogram *pluginLowTimeHist; 248 Histogram *reqHdlrLowTimeHist;
247 Histogram *pluginHighTimeHist; 249 Histogram *reqHdlrHighTimeHist;
248 #endif 250 #endif
249 #ifdef MEAS__TIME_MALLOC 251 #ifdef MEAS__TIME_MALLOC
250 Histogram *mallocTimeHist; 252 Histogram *mallocTimeHist;
251 Histogram *freeTimeHist; 253 Histogram *freeTimeHist;
252 #endif 254 #endif
388 movl %%eax, %0;" \ 390 movl %%eax, %0;" \
389 /* outputs */ : "=m" (low) \ 391 /* outputs */ : "=m" (low) \
390 /* inputs */ : \ 392 /* inputs */ : \
391 /* clobber */ : "%eax", "%edx" \ 393 /* clobber */ : "%eax", "%edx" \
392 ); 394 );
395
396 //====================
397 #define makeAMeasHist( idx, name, numBins, startVal, binWidth ) \
398 makeHighestDynArrayIndexBeAtLeast( _VMSMasterEnv->measHistsInfo, idx ); \
399 _VMSMasterEnv->measHists[idx] = \
400 makeFixedBinHist( numBins, startVal, binWidth, name );
401
402
403 #define MEAS__SUB_CREATE /*turn on/off subtraction of create from plugin*/
404 #define createHistIdx 1
405 #define mutexLockHistIdx 2
406 #define mutexUnlockHistIdx 3
407 #define condWaitHistIdx 4
408 #define condSignalHistIdx 5
409
410
411 #define MakeTheMeasHists \
412 _VMSMasterEnv->measHistsInfo = \
413 makePrivDynArrayOfSize( &(_VMSMasterEnv->measHists), 200);\
414 makeAMeasHist( createHistIdx, "Create", 50, 0, 200 ) \
415 makeAMeasHist( mutexLockHistIdx, "mutex lock", 50, 0, 100 ) \
416 makeAMeasHist( mutexUnlockHistIdx, "mutex unlock", 50, 0, 100 ) \
417 makeAMeasHist( condWaitHistIdx, "cond wait", 50, 0, 100 ) \
418 makeAMeasHist( condSignalHistIdx, "cond signal", 50, 0, 100 )
419
420 #define Meas_startCreate \
421 int32 startStamp, endStamp; \
422 saveLowTimeStampCountInto( startStamp ); \
423
424 #define Meas_endCreate \
425 saveLowTimeStampCountInto( endStamp ); \
426 addIntervalToHist( startStamp, endStamp, \
427 _VMSMasterEnv->measHists[ createHistIdx ] );
428
429 #define Meas_startMutexLock \
430 int32 startStamp, endStamp; \
431 saveLowTimeStampCountInto( startStamp ); \
432
433 #define Meas_endMutexLock \
434 saveLowTimeStampCountInto( endStamp ); \
435 addIntervalToHist( startStamp, endStamp, \
436 _VMSMasterEnv->measHists[ mutexLockHistIdx ] );
437
438 #define Meas_startMutexUnlock \
439 int32 startStamp, endStamp; \
440 saveLowTimeStampCountInto( startStamp ); \
441
442 #define Meas_endMutexUnlock \
443 saveLowTimeStampCountInto( endStamp ); \
444 addIntervalToHist( startStamp, endStamp, \
445 _VMSMasterEnv->measHists[ mutexUnlockHistIdx ] );
446
447 #define Meas_startCondWait \
448 int32 startStamp, endStamp; \
449 saveLowTimeStampCountInto( startStamp ); \
450
451 #define Meas_endCondWait \
452 saveLowTimeStampCountInto( endStamp ); \
453 addIntervalToHist( startStamp, endStamp, \
454 _VMSMasterEnv->measHists[ condWaitHistIdx ] );
455
456 #define Meas_startCondSignal \
457 int32 startStamp, endStamp; \
458 saveLowTimeStampCountInto( startStamp ); \
459
460 #define Meas_endCondSignal \
461 saveLowTimeStampCountInto( endStamp ); \
462 addIntervalToHist( startStamp, endStamp, \
463 _VMSMasterEnv->measHists[ condSignalHistIdx ] );
464
465
393 //===== 466 //=====
394 467
395 #include "SwitchAnimators.h" 468 #include "SwitchAnimators.h"
396 #include "probes.h" 469 #include "probes.h"
397 #include "vutilities.h" 470 #include "vutilities.h"