# HG changeset patch # User Me # Date 1288142310 25200 # Node ID 054006c26b9297c9193a9f7ca863187d25177809 # Parent 72373405c8163cc74f64f6ff5c9613b0b386c20d Added instrumentation to measure master time, master lock time and create time diff -r 72373405c816 -r 054006c26b92 CoreLoop.c --- a/CoreLoop.c Sat Oct 16 04:11:15 2010 -0700 +++ b/CoreLoop.c Tue Oct 26 18:18:30 2010 -0700 @@ -117,19 +117,15 @@ //run own MasterVP -- when its done, unlocks MasterLock and // jumps back to coreLoops's startPt currPr = _VMSMasterEnv->masterVPs[thisCoresIdx]; + addToHist( tries, _VMSMasterEnv->stats->masterLockHist ); break; //end while -- have a VP to animate now } - //Aug 24, 2010 -- changed so each core loop only gets work scheduled - // by its own master, so now stay in loop until get lock -// currPr = (VirtProcr *) readSRSWQ_NonBlocking( readyToAnimateQ ); tries++; -// if( tries % 10000 == 0 ) printf("empty tries: %d\n", tries/10000 ); + if( tries % READYTOANIMATE_RETRIES == 0 ) pthread_yield(); } -// currPr->coreAnimatedBy = coreLoopThdParams->coreNum; - //switch to virt procr's stack and frame ptr then jump to virt procr fn void *stackPtr, *framePtr, *jmpPt, *coreLoopFramePtrAddr, \ *coreLoopStackPtrAddr; diff -r 72373405c816 -r 054006c26b92 MasterLoop.c --- a/MasterLoop.c Sat Oct 16 04:11:15 2010 -0700 +++ b/MasterLoop.c Tue Oct 26 18:18:30 2010 -0700 @@ -100,10 +100,11 @@ masterLoopStartPt: //============================= MEASUREMENT STUFF ======================== #ifdef MEAS__TIME_MASTER + int startStamp, endStamp; //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. - saveLowTimeStampCountInto( masterPr->startMasterTSCLow ); + saveLowTimeStampCountInto( startStamp ); #endif //======================================================================== @@ -164,9 +165,12 @@ coreLoopFramePtr = masterPr->coreLoopFramePtr;//need this only coreLoopStackPtr = masterPr->coreLoopStackPtr;//shouldn't need -- safety + //============================= MEASUREMENT STUFF ======================== #ifdef MEAS__TIME_MASTER - saveLowTimeStampCountInto( masterPr->endMasterTSCLow ); + saveLowTimeStampCountInto( endStamp ); + addIntervalToHist(startStamp,endStamp,_VMSMasterEnv->stats->masterTimeHist); #endif + //======================================================================== asm volatile("movl %0, %%eax; \ movl %%esp, (%%eax); \ diff -r 72373405c816 -r 054006c26b92 VMS.c --- a/VMS.c Sat Oct 16 04:11:15 2010 -0700 +++ b/VMS.c Tue Oct 26 18:18:30 2010 -0700 @@ -112,7 +112,14 @@ _VMSMasterEnv->masterVPs = masterVPs; _VMSMasterEnv->allSchedSlots = allSchedSlots; + //============================= MEASUREMENT STUFF ======================== + #ifdef MEAS__TIME_MASTER + _VMSMasterEnv->stats->masterTimeHist = makeHistogram( 25, 500, 800 ); + _VMSMasterEnv->stats->masterLockHist = makeHistogram( 25, 0, 100000 ); + _VMSMasterEnv->stats->createHist = makeHistogram( 25, 0, 5000 ); + #endif + //======================================================================== //Aug 19, 2010: no longer need to place initial masterVP into queue // because coreLoop now controls -- animates its masterVP when no work @@ -305,6 +312,13 @@ { VirtProcr *newPr; char *stackLocs, *stackPtr; + //============================= MEASUREMENT STUFF ======================== + #ifdef MEAS__TIME_MASTER + int32 startStamp; + saveLowTimeStampCountInto( startStamp ); + #endif + //======================================================================== + newPr = malloc( sizeof(VirtProcr) ); newPr->procrID = numProcrsCreated++; newPr->nextInstrPt = fnPtr; @@ -327,6 +341,15 @@ newPr->stackPtr = stackPtr; //core loop will switch to this, then newPr->framePtr = stackPtr; //suspend loop will save new stack & frame ptr + //============================= MEASUREMENT STUFF ======================== + #ifdef MEAS__TIME_MASTER + int32 endStamp; + saveLowTimeStampCountInto( endStamp ); + addIntervalToHist( startStamp, endStamp, + _VMSMasterEnv->stats->createHist ); + #endif + //======================================================================== + return newPr; } diff -r 72373405c816 -r 054006c26b92 VMS.h --- a/VMS.h Sat Oct 16 04:11:15 2010 -0700 +++ b/VMS.h Tue Oct 26 18:18:30 2010 -0700 @@ -139,6 +139,13 @@ //VirtProcr +typedef struct + { + Histogram *createHist; + Histogram *masterLockHist; + Histogram *masterTimeHist; + } +VMSStats; typedef struct { @@ -158,6 +165,7 @@ int setupComplete; int masterLock; + VMSStats *stats; } MasterEnv;