# HG changeset patch # User Me # Date 1290237545 -3600 # Node ID 9c3107044f86c36fea3a8f72f64910b1363555be # Parent 2377967a27327fe79d955e1880cfaea5a72a9d8b Added measurement hists macros diff -r 2377967a2732 -r 9c3107044f86 MasterLoop.c --- a/MasterLoop.c Tue Nov 16 16:00:32 2010 +0100 +++ b/MasterLoop.c Sat Nov 20 08:19:05 2010 +0100 @@ -108,8 +108,8 @@ //============================= MEASUREMENT STUFF ======================== #ifdef MEAS__TIME_MASTER //Total Master time includes one coreloop time -- just assume the core - // loop time is same for Master as for AppVPs, even though it will be - // smaller due to high predictability of the fixed jmp. + // loop time is same for Master as for AppVPs, even though it may be + // smaller due to higher predictability of the fixed jmp. saveLowTimeStampCountInto( masterPr->startMasterTSCLow ); #endif //======================================================================== @@ -139,7 +139,22 @@ currSlot->needsProcrAssigned = TRUE; //process requests from slave to master + //====================== MEASUREMENT STUFF =================== + #ifdef MEAS__TIME_PLUGIN + int32 startStamp1, endStamp1; + saveLowTimeStampCountInto( startStamp1 ); + #endif + //============================================================ (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); + //====================== MEASUREMENT STUFF =================== + #ifdef MEAS__TIME_PLUGIN + saveLowTimeStampCountInto( endStamp1 ); + addIntervalToHist( startStamp1, endStamp1, + _VMSMasterEnv->reqHdlrLowTimeHist ); + addIntervalToHist( startStamp1, endStamp1, + _VMSMasterEnv->reqHdlrHighTimeHist ); + #endif + //============================================================ } if( currSlot->needsProcrAssigned ) { //give slot a new virt procr diff -r 2377967a2732 -r 9c3107044f86 VMS.c --- a/VMS.c Tue Nov 16 16:00:32 2010 +0100 +++ b/VMS.c Sat Nov 20 08:19:05 2010 +0100 @@ -104,11 +104,17 @@ //============================= MEASUREMENT STUFF ======================== #ifdef MEAS__TIME_MALLOC - _VMSMasterEnv->mallocTimeHist = makeFixedBinHistExt( 100, 50, 10, + _VMSMasterEnv->mallocTimeHist = makeFixedBinHistExt( 50, 0, 100, "malloc time hist"); - _VMSMasterEnv->freeTimeHist = makeFixedBinHistExt( 100, 50, 10, + _VMSMasterEnv->freeTimeHist = makeFixedBinHistExt( 50, 0, 100, "free time hist"); #endif + #ifdef MEAS__TIME_PLUGIN + _VMSMasterEnv->reqHdlrLowTimeHist = makeFixedBinHistExt( 50, 0, 10, + "plugin low time hist"); + _VMSMasterEnv->reqHdlrHighTimeHist = makeFixedBinHistExt( 50, 0, 100, + "plugin high time hist"); + #endif //======================================================================== //===================== Only VMS__malloc after this ==================== @@ -157,18 +163,14 @@ _VMSMasterEnv->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0); #endif - #ifdef MEAS__TIME_PLUGIN - _VMSMasterEnv->pluginLowTimeHist = makeFixedBinHist( 50, 0, 2, - "plugin low time hist"); - _VMSMasterEnv->pluginHighTimeHist = makeFixedBinHist( 100, 0, 200, - "plugin high time hist"); - #endif #ifdef MEAS__TIME_MASTER_LOCK _VMSMasterEnv->masterLockLowTimeHist = makeFixedBinHist( 50, 0, 2, "master lock low time hist"); - _VMSMasterEnv->masterLockHighTimeHist = makeFixedBinHist( 100, 0, 200, + _VMSMasterEnv->masterLockHighTimeHist = makeFixedBinHist( 50, 0, 100, "master lock high time hist"); #endif + + MakeTheMeasHists //======================================================================== } @@ -765,9 +767,13 @@ SchedSlot ***allSchedSlots; //ptr to array of ptrs //Before getting rid of everything, print out any measurements made + forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &printHist ); + //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &freeHistExt ); #ifdef MEAS__TIME_PLUGIN - printHist( _VMSMasterEnv->pluginLowTimeHist ); - printHist( _VMSMasterEnv->pluginHighTimeHist ); + printHist( _VMSMasterEnv->reqHdlrLowTimeHist ); + printHist( _VMSMasterEnv->reqHdlrHighTimeHist ); + freeHistExt( _VMSMasterEnv->reqHdlrLowTimeHist ); + freeHistExt( _VMSMasterEnv->reqHdlrHighTimeHist ); #endif #ifdef MEAS__TIME_MALLOC printHist( _VMSMasterEnv->mallocTimeHist ); diff -r 2377967a2732 -r 9c3107044f86 VMS.h --- a/VMS.h Tue Nov 16 16:00:32 2010 +0100 +++ b/VMS.h Sat Nov 20 08:19:05 2010 +0100 @@ -37,14 +37,14 @@ //These defines turn types of bug messages on and off // be sure debug messages are un-commented (next block of defines) +#define dbgAppFlow TRUE /* Top level flow of application code -- general*/ #define dbgProbes FALSE /* for issues inside probes themselves*/ -#define dbgAppFlow FALSE /* Top level flow of application code -- general*/ #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/ #define dbgRqstHdlr FALSE /* in request handler code*/ //Comment or un- the substitute half to turn on/off types of debug message #define DEBUG( bool, msg) \ -// if( bool){ printf(msg); fflush(stdin);} +// if( bool){ printf(msg); fflush(stdin);} #define DEBUG1( bool, msg, param) \ // if(bool){printf(msg, param); fflush(stdin);} #define DEBUG2( bool, msg, p1, p2) \ @@ -65,7 +65,7 @@ //#define MEAS__TIME_MASTER #define MEAS__TIME_PLUGIN #define MEAS__TIME_MALLOC -#define MEAS__TIME_MASTER_LOCK +//#define MEAS__TIME_MASTER_LOCK #define MEAS__NUM_TIMES_TO_RUN 100000 //For code that calculates normalization-offset between TSC counts of @@ -242,9 +242,11 @@ HashTable *probeNameHashTbl; int32 masterCreateProbeID; float64 createPtInSecs; + Histogram **measHists; + PrivDynArrayInfo *measHistsInfo; #ifdef MEAS__TIME_PLUGIN - Histogram *pluginLowTimeHist; - Histogram *pluginHighTimeHist; + Histogram *reqHdlrLowTimeHist; + Histogram *reqHdlrHighTimeHist; #endif #ifdef MEAS__TIME_MALLOC Histogram *mallocTimeHist; @@ -390,6 +392,77 @@ /* inputs */ : \ /* clobber */ : "%eax", "%edx" \ ); + +//==================== +#define makeAMeasHist( idx, name, numBins, startVal, binWidth ) \ + makeHighestDynArrayIndexBeAtLeast( _VMSMasterEnv->measHistsInfo, idx ); \ + _VMSMasterEnv->measHists[idx] = \ + makeFixedBinHist( numBins, startVal, binWidth, name ); + + +#define MEAS__SUB_CREATE /*turn on/off subtraction of create from plugin*/ +#define createHistIdx 1 +#define mutexLockHistIdx 2 +#define mutexUnlockHistIdx 3 +#define condWaitHistIdx 4 +#define condSignalHistIdx 5 + + +#define MakeTheMeasHists \ + _VMSMasterEnv->measHistsInfo = \ + makePrivDynArrayOfSize( &(_VMSMasterEnv->measHists), 200);\ + makeAMeasHist( createHistIdx, "Create", 50, 0, 200 ) \ + makeAMeasHist( mutexLockHistIdx, "mutex lock", 50, 0, 100 ) \ + makeAMeasHist( mutexUnlockHistIdx, "mutex unlock", 50, 0, 100 ) \ + makeAMeasHist( condWaitHistIdx, "cond wait", 50, 0, 100 ) \ + makeAMeasHist( condSignalHistIdx, "cond signal", 50, 0, 100 ) + +#define Meas_startCreate \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endCreate \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ createHistIdx ] ); + +#define Meas_startMutexLock \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endMutexLock \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ mutexLockHistIdx ] ); + +#define Meas_startMutexUnlock \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endMutexUnlock \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ mutexUnlockHistIdx ] ); + +#define Meas_startCondWait \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endCondWait \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ condWaitHistIdx ] ); + +#define Meas_startCondSignal \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endCondSignal \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ condSignalHistIdx ] ); + + //===== #include "SwitchAnimators.h" diff -r 2377967a2732 -r 9c3107044f86 vmalloc.c --- a/vmalloc.c Tue Nov 16 16:00:32 2010 +0100 +++ b/vmalloc.c Sat Nov 20 08:19:05 2010 +0100 @@ -11,6 +11,7 @@ #include #include "VMS.h" +#include "Histogram/Histogram.h" /*Helper function *Insert a newly generated free chunk into the first spot on the free list.