changeset 48:054006c26b92 measure_brch

Added instrumentation to measure master time, master lock time and create time
author Me
date Tue, 26 Oct 2010 18:18:30 -0700
parents 72373405c816
children 4fbc2165e493
files CoreLoop.c MasterLoop.c VMS.c VMS.h
diffstat 4 files changed, 39 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/CoreLoop.c	Sat Oct 16 04:11:15 2010 -0700
     1.2 +++ b/CoreLoop.c	Tue Oct 26 18:18:30 2010 -0700
     1.3 @@ -117,19 +117,15 @@
     1.4              //run own MasterVP -- when its done, unlocks MasterLock and
     1.5              // jumps back to coreLoops's startPt
     1.6           currPr = _VMSMasterEnv->masterVPs[thisCoresIdx];
     1.7 +         addToHist( tries, _VMSMasterEnv->stats->masterLockHist );
     1.8           break;  //end while -- have a VP to animate now
     1.9         }
    1.10 -         //Aug 24, 2010 -- changed so each core loop only gets work scheduled
    1.11 -         // by its own master, so now stay in loop until get lock
    1.12 -//      currPr = (VirtProcr *) readSRSWQ_NonBlocking( readyToAnimateQ );
    1.13        
    1.14        tries++;
    1.15 -//      if( tries % 10000 == 0 ) printf("empty tries: %d\n", tries/10000 );
    1.16 +      
    1.17        if( tries % READYTOANIMATE_RETRIES == 0 ) pthread_yield();
    1.18      }
    1.19     
    1.20 -//   currPr->coreAnimatedBy  = coreLoopThdParams->coreNum;
    1.21 -
    1.22        //switch to virt procr's stack and frame ptr then jump to virt procr fn
    1.23     void *stackPtr, *framePtr, *jmpPt, *coreLoopFramePtrAddr, \
    1.24          *coreLoopStackPtrAddr;
     2.1 --- a/MasterLoop.c	Sat Oct 16 04:11:15 2010 -0700
     2.2 +++ b/MasterLoop.c	Tue Oct 26 18:18:30 2010 -0700
     2.3 @@ -100,10 +100,11 @@
     2.4     masterLoopStartPt:
     2.5     //============================= MEASUREMENT STUFF ========================
     2.6     #ifdef MEAS__TIME_MASTER
     2.7 +   int startStamp, endStamp;
     2.8        //Total Master time includes one coreloop time -- just assume the core
     2.9        // loop time is same for Master as for AppVPs, even though it will be
    2.10        // smaller due to high predictability of the fixed jmp.
    2.11 -   saveLowTimeStampCountInto( masterPr->startMasterTSCLow );
    2.12 +   saveLowTimeStampCountInto( startStamp );
    2.13     #endif
    2.14     //========================================================================
    2.15  
    2.16 @@ -164,9 +165,12 @@
    2.17     coreLoopFramePtr  = masterPr->coreLoopFramePtr;//need this only
    2.18     coreLoopStackPtr  = masterPr->coreLoopStackPtr;//shouldn't need -- safety
    2.19     
    2.20 +   //============================= MEASUREMENT STUFF ========================
    2.21     #ifdef MEAS__TIME_MASTER
    2.22 -   saveLowTimeStampCountInto( masterPr->endMasterTSCLow );
    2.23 +   saveLowTimeStampCountInto( endStamp );
    2.24 +   addIntervalToHist(startStamp,endStamp,_VMSMasterEnv->stats->masterTimeHist);
    2.25     #endif
    2.26 +   //========================================================================
    2.27  
    2.28     asm volatile("movl %0,     %%eax;  \
    2.29                   movl %%esp, (%%eax); \
     3.1 --- a/VMS.c	Sat Oct 16 04:11:15 2010 -0700
     3.2 +++ b/VMS.c	Tue Oct 26 18:18:30 2010 -0700
     3.3 @@ -112,7 +112,14 @@
     3.4     _VMSMasterEnv->masterVPs        = masterVPs;
     3.5     _VMSMasterEnv->allSchedSlots    = allSchedSlots;
     3.6  
     3.7 +   //============================= MEASUREMENT STUFF ========================
     3.8 +   #ifdef MEAS__TIME_MASTER
     3.9  
    3.10 +   _VMSMasterEnv->stats->masterTimeHist = makeHistogram( 25, 500,    800 );
    3.11 +   _VMSMasterEnv->stats->masterLockHist = makeHistogram( 25,   0, 100000 );
    3.12 +   _VMSMasterEnv->stats->createHist     = makeHistogram( 25,   0,   5000 );
    3.13 +   #endif
    3.14 +   //========================================================================
    3.15  
    3.16        //Aug 19, 2010:  no longer need to place initial masterVP into queue
    3.17        // because coreLoop now controls -- animates its masterVP when no work
    3.18 @@ -305,6 +312,13 @@
    3.19   { VirtProcr *newPr;
    3.20     char      *stackLocs, *stackPtr;
    3.21  
    3.22 +   //============================= MEASUREMENT STUFF ========================
    3.23 +   #ifdef MEAS__TIME_MASTER
    3.24 +   int32 startStamp;
    3.25 +   saveLowTimeStampCountInto( startStamp );
    3.26 +   #endif
    3.27 +   //========================================================================
    3.28 +
    3.29     newPr              = malloc( sizeof(VirtProcr) );
    3.30     newPr->procrID     = numProcrsCreated++;
    3.31     newPr->nextInstrPt = fnPtr;
    3.32 @@ -327,6 +341,15 @@
    3.33     newPr->stackPtr = stackPtr; //core loop will switch to this, then
    3.34     newPr->framePtr = stackPtr; //suspend loop will save new stack & frame ptr
    3.35  
    3.36 +  //============================= MEASUREMENT STUFF ========================
    3.37 +   #ifdef MEAS__TIME_MASTER
    3.38 +   int32 endStamp;
    3.39 +   saveLowTimeStampCountInto( endStamp );
    3.40 +   addIntervalToHist( startStamp, endStamp,
    3.41 +                      _VMSMasterEnv->stats->createHist );
    3.42 +   #endif
    3.43 +   //========================================================================
    3.44 +   
    3.45     return newPr;
    3.46   }
    3.47  
     4.1 --- a/VMS.h	Sat Oct 16 04:11:15 2010 -0700
     4.2 +++ b/VMS.h	Tue Oct 26 18:18:30 2010 -0700
     4.3 @@ -139,6 +139,13 @@
     4.4  //VirtProcr
     4.5  
     4.6  
     4.7 +typedef struct
     4.8 + {
     4.9 +   Histogram *createHist;
    4.10 +   Histogram *masterLockHist;
    4.11 +   Histogram *masterTimeHist;
    4.12 + }
    4.13 +VMSStats;
    4.14  
    4.15  typedef struct
    4.16   {
    4.17 @@ -158,6 +165,7 @@
    4.18     int              setupComplete;
    4.19     int              masterLock;
    4.20  
    4.21 +   VMSStats        *stats;
    4.22   }
    4.23  MasterEnv;
    4.24