changeset 140:2c8f3cf6c058 DistributedMalloc2

Free memory calculation
author Merten Sach <msach@mailbox.tu-berlin.de>
date Mon, 19 Sep 2011 18:43:08 +0200
parents 99798e4438a6
children 79bb48d7d93b
files MasterLoop.c VMS.c vmalloc.c
diffstat 3 files changed, 8 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/MasterLoop.c	Mon Sep 19 16:12:01 2011 +0200
     1.2 +++ b/MasterLoop.c	Mon Sep 19 18:43:08 2011 +0200
     1.3 @@ -107,7 +107,7 @@
     1.4  	  // So, just make this an endless loop, and do assembly function at end
     1.5  	  // that saves its own return addr, then jumps to core_loop.
     1.6     while(1)
     1.7 -   {       
     1.8 +   {
     1.9     //============================= MEASUREMENT STUFF ========================
    1.10     #ifdef MEAS__TIME_MASTER
    1.11        //Total Master time includes one coreloop time -- just assume the core
     2.1 --- a/VMS.c	Mon Sep 19 16:12:01 2011 +0200
     2.2 +++ b/VMS.c	Mon Sep 19 18:43:08 2011 +0200
     2.3 @@ -114,6 +114,7 @@
     2.4         _VMSMasterEnv->interMasterRequestsSentBy[i] = NULL;
     2.5     }
     2.6     _VMSMasterEnv->currentMasterProcrID = 0;
     2.7 +   _VMSMasterEnv->amtOfOutstandingMem = NUM_CORES*MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE;
     2.8  
     2.9     //============================= MEASUREMENT STUFF ========================
    2.10     #ifdef MEAS__TIME_MALLOC
     3.1 --- a/vmalloc.c	Mon Sep 19 16:12:01 2011 +0200
     3.2 +++ b/vmalloc.c	Mon Sep 19 18:43:08 2011 +0200
     3.3 @@ -15,6 +15,7 @@
     3.4  #include <math.h>
     3.5  
     3.6  #include "VMS.h"
     3.7 +#include "vmalloc.h"
     3.8  #include "Histogram/Histogram.h"
     3.9  
    3.10  #define MAX_UINT64 0xFFFFFFFFFFFFFFFF
    3.11 @@ -106,7 +107,7 @@
    3.12     {
    3.13         //Find the approppiate container because we do not know it
    3.14         uint64 containerIdx = ((uintptr_t)chunk->prevChunkInFreeList - (uintptr_t)freeLists->bigChunks) >> 3;
    3.15 -       if(containerIdx < (uint32)64)
    3.16 +       if(containerIdx < (uint64)64)
    3.17             freeLists->bigChunksSearchVector[0] &= ~((uint64)1 << containerIdx); 
    3.18         if(containerIdx < 128 && containerIdx >=64)
    3.19             freeLists->bigChunksSearchVector[1] &= ~((uint64)1 << (containerIdx-64)); 
    3.20 @@ -251,9 +252,10 @@
    3.21         else
    3.22             foundChunk = removeSmallChunk(freeLists, freeListIdx);
    3.23         
    3.24 +       _VMSMasterEnv->amtOfOutstandingMem -= getChunkSize(foundChunk) + sizeof(MallocProlog);
    3.25         returnChunk = (MallocPrologAllocated*)foundChunk;
    3.26         returnChunk->prevChunkInFreeList = NULL;//indicates elem currently allocated
    3.27 -       returnChunk->procrID = procrID;  
    3.28 +       returnChunk->procrID = procrID;
    3.29         return returnChunk + 1;
    3.30     }
    3.31     
    3.32 @@ -267,6 +269,7 @@
    3.33         foundChunk = removeChunk(freeLists, containerIdx); 
    3.34     
    3.35     //Mark as allocated
    3.36 +   _VMSMasterEnv->amtOfOutstandingMem -= getChunkSize(foundChunk) + sizeof(MallocProlog);
    3.37     returnChunk = (MallocPrologAllocated*)foundChunk;
    3.38     returnChunk->prevChunkInFreeList = NULL;//indicates elem currently allocated
    3.39     returnChunk->procrID = procrID;
    3.40 @@ -372,6 +375,7 @@
    3.41     MallocArrays* freeLists = _VMSMasterEnv->freeLists[procrID];
    3.42     MallocProlog *chunkToFree = (MallocProlog*)ptrToFree - 1;
    3.43     uint32 containerIdx;
    3.44 +   _VMSMasterEnv->amtOfOutstandingMem += getChunkSize(chunkToFree) + sizeof(MallocProlog);
    3.45     
    3.46     //Check for free neighbors
    3.47     if(chunkToFree->nextLowerInMem)