diff vmalloc.c @ 65:13b22ffb8a2f

Nov 14 vers -- Added measurement of Plugin, malloc, & master lock, + vutilities
author Me
date Sun, 14 Nov 2010 11:17:52 -0800
parents 7b799a46cc87
children bf08108405cc 9c3107044f86
line diff
     1.1 --- a/vmalloc.c	Sat Nov 13 14:39:40 2010 -0800
     1.2 +++ b/vmalloc.c	Sun Nov 14 11:17:52 2010 -0800
     1.3 @@ -49,6 +49,13 @@
     1.4   { MallocProlog *foundElem = NULL, *currElem, *newElem;
     1.5     int32         amountExtra, foundElemIsTopOfHeap, sizeConsumed,sizeOfFound;
     1.6  
     1.7 +   //============================= MEASUREMENT STUFF ========================
     1.8 +   #ifdef MEAS__TIME_MALLOC
     1.9 +   int32 startStamp, endStamp;
    1.10 +   saveLowTimeStampCountInto( startStamp );
    1.11 +   #endif
    1.12 +   //========================================================================
    1.13 +   
    1.14        //step up the size to be aligned at 16-byte boundary, prob better ways
    1.15     sizeRequested = ((sizeRequested + 16) >> 4) << 4;
    1.16     currElem = (_VMSMasterEnv->freeListHead)->nextChunkInFreeList;
    1.17 @@ -108,6 +115,13 @@
    1.18      }
    1.19    _VMSMasterEnv->amtOfOutstandingMem += sizeConsumed;
    1.20  
    1.21 +   //============================= MEASUREMENT STUFF ========================
    1.22 +   #ifdef MEAS__TIME_MALLOC
    1.23 +   saveLowTimeStampCountInto( endStamp );
    1.24 +   addIntervalToHist( startStamp, endStamp, _VMSMasterEnv->mallocTimeHist );
    1.25 +   #endif
    1.26 +   //========================================================================
    1.27 +
    1.28        //skip over the prolog by adding its size to the pointer return
    1.29     return (void *)((char *)foundElem + sizeof(MallocProlog));
    1.30   }
    1.31 @@ -124,6 +138,13 @@
    1.32   { MallocProlog *elemToFree, *nextLowerElem, *nextHigherElem;
    1.33     int32         lowerExistsAndIsFree, higherExistsAndIsFree, sizeOfElem;
    1.34  
    1.35 +   //============================= MEASUREMENT STUFF ========================
    1.36 +   #ifdef MEAS__TIME_MALLOC
    1.37 +   int32 startStamp, endStamp;
    1.38 +   saveLowTimeStampCountInto( startStamp );
    1.39 +   #endif
    1.40 +   //========================================================================
    1.41 +
    1.42     if( ptrToFree < (void*)_VMSMasterEnv->freeListHead->nextLowerInMem ||
    1.43         ptrToFree > (void*)_VMSMasterEnv->freeListHead->nextHigherInMem )
    1.44      {    //outside the range of data owned by VMS's malloc, so do nothing
    1.45 @@ -211,6 +232,12 @@
    1.46           elemToFree->prevChunkInFreeList = _VMSMasterEnv->freeListHead;
    1.47         }
    1.48      }
    1.49 +   //============================= MEASUREMENT STUFF ========================
    1.50 +   #ifdef MEAS__TIME_MALLOC
    1.51 +   saveLowTimeStampCountInto( endStamp );
    1.52 +   addIntervalToHist( startStamp, endStamp, _VMSMasterEnv->freeTimeHist );
    1.53 +   #endif
    1.54 +   //========================================================================
    1.55  
    1.56   }
    1.57