40 |
|
*/ |
41 |
|
#include <algorithm> |
42 |
|
#include "brains/BlockSnapshotManager.hpp" |
43 |
+ |
#include "utils/residentMem.h" |
44 |
|
#include "utils/physmem.h" |
45 |
|
#include "utils/Algorithm.hpp" |
46 |
|
#include "brains/SimInfo.hpp" |
55 |
|
nAtoms_ = info->getNGlobalAtoms(); |
56 |
|
nRigidBodies_ = info->getNGlobalRigidBodies(); |
57 |
|
|
58 |
< |
double avalPhysMem = physmem_available(); |
58 |
> |
double physMem = physmem_total(); |
59 |
> |
double rssMem = residentMem(); |
60 |
> |
double avaliablePhysMem = physMem - rssMem; |
61 |
|
|
62 |
+ |
std::cout << "physmem = " << int(physMem) << "\trssMem = "<< rssMem << "\t availablePhysMem = " << avaliablePhysMem <<std::endl; |
63 |
|
int bytesPerStuntDouble = DataStorage::getBytesPerStuntDouble(storageLayout); |
64 |
|
|
65 |
|
int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble; |
66 |
|
|
67 |
< |
int frameCapacity = int (avalPhysMem / bytesPerFrame); |
67 |
> |
int frameCapacity = int (avaliablePhysMem / bytesPerFrame); |
68 |
|
|
69 |
|
nSnapshotPerBlock_ = frameCapacity /blockCapacity_ ; |
70 |
|
|
182 |
|
} |
183 |
|
|
184 |
|
bool BlockSnapshotManager::hasZeroRefBlock(){ |
185 |
< |
return std::find(activeRefCount_.begin(), activeRefCount_.end(), 0); |
185 |
> |
return std::find(activeRefCount_.begin(), activeRefCount_.end(), 0) != activeRefCount_.end() ? true : false; |
186 |
|
} |
187 |
|
|
188 |
|
int BlockSnapshotManager::getFirstZeroRefBlock(){ |