TuttleOFX
1
|
#include <MemoryPool.hpp>
Public Member Functions | |
MemoryPool (const std::size_t maxSize=0) | |
~MemoryPool () | |
IPoolDataPtr | allocate (const std::size_t size) |
std::size_t | updateMemoryAuthorizedWithRAM () |
void | referenced (PoolData *) |
void | released (PoolData *) |
std::size_t | getUsedMemorySize () const |
std::size_t | getAllocatedAndUnusedMemorySize () const |
std::size_t | getAllocatedMemorySize () const |
std::size_t | getMaxMemorySize () const |
std::size_t | getAvailableMemorySize () const |
std::size_t | getWastedMemorySize () const |
std::size_t | getDataUsedSize () const |
std::size_t | getDataUnusedSize () const |
void | clear (std::size_t size) |
void | clear () |
void | clearOne () |
Private Types | |
typedef boost::unordered_set < PoolData * > | DataList |
Private Attributes | |
boost::ptr_list< PoolData > | _allDatas |
std::map< char *, PoolData * > | _dataMap |
DataList | _dataUsed |
DataList | _dataUnused |
std::size_t | _memoryAuthorized |
boost::mutex | _mutex |
Definition at line 33 of file MemoryPool.hpp.
typedef boost::unordered_set<PoolData*> tuttle::host::memory::MemoryPool::DataList [private] |
Definition at line 61 of file MemoryPool.hpp.
tuttle::host::memory::MemoryPool::MemoryPool | ( | const std::size_t | maxSize = 0 | ) |
Definition at line 83 of file MemoryPool.cpp.
tuttle::host::memory::MemoryPool::~MemoryPool | ( | ) |
Definition at line 87 of file MemoryPool.cpp.
boost::intrusive_ptr< IPoolData > tuttle::host::memory::MemoryPool::allocate | ( | const std::size_t | size | ) |
Definition at line 156 of file MemoryPool.cpp.
References _dataUnused, _mutex, tuttle::host::memory::PoolData::_size, terry::algorithm::for_each(), getAvailableMemorySize(), TUTTLE_TLOG, and TUTTLE_TRACE.
Referenced by BOOST_AUTO_TEST_CASE().
void tuttle::host::memory::MemoryPool::clear | ( | std::size_t | size | ) |
Definition at line 247 of file MemoryPool.cpp.
void tuttle::host::memory::MemoryPool::clear | ( | ) | [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 252 of file MemoryPool.cpp.
References _dataUnused, and _mutex.
void tuttle::host::memory::MemoryPool::clearOne | ( | ) | [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 259 of file MemoryPool.cpp.
std::size_t tuttle::host::memory::MemoryPool::getAllocatedAndUnusedMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 210 of file MemoryPool.cpp.
References _dataUnused, and _mutex.
Referenced by getAllocatedMemorySize().
std::size_t tuttle::host::memory::MemoryPool::getAllocatedMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 216 of file MemoryPool.cpp.
References getAllocatedAndUnusedMemorySize(), and getUsedMemorySize().
Referenced by BOOST_AUTO_TEST_CASE().
std::size_t tuttle::host::memory::MemoryPool::getAvailableMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 226 of file MemoryPool.cpp.
References getMaxMemorySize(), and getUsedMemorySize().
Referenced by allocate().
std::size_t tuttle::host::memory::MemoryPool::getDataUnusedSize | ( | ) | const |
Definition at line 242 of file MemoryPool.cpp.
References _dataUnused.
std::size_t tuttle::host::memory::MemoryPool::getDataUsedSize | ( | ) | const |
Definition at line 237 of file MemoryPool.cpp.
References _dataUsed.
std::size_t tuttle::host::memory::MemoryPool::getMaxMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 221 of file MemoryPool.cpp.
References _memoryAuthorized.
Referenced by BOOST_AUTO_TEST_CASE(), and getAvailableMemorySize().
std::size_t tuttle::host::memory::MemoryPool::getUsedMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 204 of file MemoryPool.cpp.
References _dataUsed, and _mutex.
Referenced by BOOST_AUTO_TEST_CASE(), getAllocatedMemorySize(), and getAvailableMemorySize().
std::size_t tuttle::host::memory::MemoryPool::getWastedMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 231 of file MemoryPool.cpp.
References _dataUsed, and _mutex.
Referenced by BOOST_AUTO_TEST_CASE().
void tuttle::host::memory::MemoryPool::referenced | ( | PoolData * | pData | ) | [virtual] |
Implements tuttle::host::memory::IPool.
Definition at line 96 of file MemoryPool.cpp.
References _allDatas, _dataMap, _dataUnused, _dataUsed, _mutex, and tuttle::host::memory::PoolData::data().
void tuttle::host::memory::MemoryPool::released | ( | PoolData * | pData | ) | [virtual] |
Implements tuttle::host::memory::IPool.
Definition at line 113 of file MemoryPool.cpp.
References _dataUnused, _dataUsed, and _mutex.
std::size_t tuttle::host::memory::MemoryPool::updateMemoryAuthorizedWithRAM | ( | ) | [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 183 of file MemoryPool.cpp.
References _memoryAuthorized, MemoryInfo::_totalRam, getMemoryInfo(), TUTTLE_LOG_DEBUG, and TUTTLE_TRACE.
boost::ptr_list<PoolData> tuttle::host::memory::MemoryPool::_allDatas [private] |
Definition at line 62 of file MemoryPool.hpp.
Referenced by referenced().
std::map<char*, PoolData*> tuttle::host::memory::MemoryPool::_dataMap [private] |
Definition at line 63 of file MemoryPool.hpp.
Referenced by referenced().
Definition at line 65 of file MemoryPool.hpp.
Referenced by allocate(), clear(), getAllocatedAndUnusedMemorySize(), getDataUnusedSize(), referenced(), and released().
Definition at line 64 of file MemoryPool.hpp.
Referenced by getDataUsedSize(), getUsedMemorySize(), getWastedMemorySize(), referenced(), and released().
std::size_t tuttle::host::memory::MemoryPool::_memoryAuthorized [private] |
Definition at line 66 of file MemoryPool.hpp.
Referenced by getMaxMemorySize(), and updateMemoryAuthorizedWithRAM().
boost::mutex tuttle::host::memory::MemoryPool::_mutex [mutable, private] |
Definition at line 67 of file MemoryPool.hpp.
Referenced by allocate(), clear(), getAllocatedAndUnusedMemorySize(), getUsedMemorySize(), getWastedMemorySize(), referenced(), and released().