TuttleOFX
1
|
#include <MemoryPool.hpp>
Public Types | |
typedef MemoryPool | This |
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 |
PoolData * | getOneAvailableData (const size_t size) |
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 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const This &v) |
Definition at line 33 of file MemoryPool.hpp.
typedef boost::unordered_set<PoolData*> tuttle::host::memory::MemoryPool::DataList [private] |
Definition at line 68 of file MemoryPool.hpp.
Definition at line 37 of file MemoryPool.hpp.
tuttle::host::memory::MemoryPool::MemoryPool | ( | const std::size_t | maxSize = 0 | ) |
Definition at line 93 of file MemoryPool.cpp.
tuttle::host::memory::MemoryPool::~MemoryPool | ( | ) |
Definition at line 97 of file MemoryPool.cpp.
References _dataUsed, and TUTTLE_LOG_DEBUG.
IPoolDataPtr tuttle::host::memory::MemoryPool::allocate | ( | const std::size_t | size | ) |
Definition at line 173 of file MemoryPool.cpp.
References clear(), tuttle::host::memory::IMemoryCache::clearUnused(), tuttle::host::core(), getAvailableMemorySize(), tuttle::host::Core::getMemoryCache(), getOneAvailableData(), tuttle::host::memory::IMemoryCache::getUnusedWithSize(), tuttle::host::memory::IMemoryCache::remove(), tuttle::host::memory::IPoolData::setSize(), TUTTLE_LOG_TRACE, TUTTLE_TLOG, and TUTTLE_TRACE.
Referenced by BOOST_AUTO_TEST_CASE().
void tuttle::host::memory::MemoryPool::clear | ( | std::size_t | size | ) |
Definition at line 301 of file MemoryPool.cpp.
void tuttle::host::memory::MemoryPool::clear | ( | ) | [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 306 of file MemoryPool.cpp.
References _dataUnused, and _mutex.
Referenced by allocate().
void tuttle::host::memory::MemoryPool::clearOne | ( | ) | [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 312 of file MemoryPool.cpp.
References _dataUnused, and _mutex.
std::size_t tuttle::host::memory::MemoryPool::getAllocatedAndUnusedMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 258 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 264 of file MemoryPool.cpp.
References getAllocatedAndUnusedMemorySize(), and getUsedMemorySize().
Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::memory::operator<<().
std::size_t tuttle::host::memory::MemoryPool::getAvailableMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 274 of file MemoryPool.cpp.
References getMaxMemorySize(), and getUsedMemorySize().
Referenced by allocate(), and tuttle::host::memory::operator<<().
std::size_t tuttle::host::memory::MemoryPool::getDataUnusedSize | ( | ) | const |
Definition at line 290 of file MemoryPool.cpp.
References _dataUnused.
Referenced by tuttle::host::memory::operator<<().
std::size_t tuttle::host::memory::MemoryPool::getDataUsedSize | ( | ) | const |
Definition at line 285 of file MemoryPool.cpp.
References _dataUsed.
Referenced by tuttle::host::memory::operator<<().
std::size_t tuttle::host::memory::MemoryPool::getMaxMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 269 of file MemoryPool.cpp.
References _memoryAuthorized.
Referenced by BOOST_AUTO_TEST_CASE(), getAvailableMemorySize(), and tuttle::host::memory::operator<<().
PoolData * tuttle::host::memory::MemoryPool::getOneAvailableData | ( | const size_t | size | ) |
Definition at line 295 of file MemoryPool.cpp.
References _dataUnused, and _mutex.
Referenced by allocate().
std::size_t tuttle::host::memory::MemoryPool::getUsedMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 252 of file MemoryPool.cpp.
References _dataUsed, and _mutex.
Referenced by BOOST_AUTO_TEST_CASE(), getAllocatedMemorySize(), getAvailableMemorySize(), and tuttle::host::memory::operator<<().
std::size_t tuttle::host::memory::MemoryPool::getWastedMemorySize | ( | ) | const [virtual] |
Implements tuttle::host::memory::IMemoryPool.
Definition at line 279 of file MemoryPool.cpp.
References _dataUsed, and _mutex.
Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::memory::operator<<().
void tuttle::host::memory::MemoryPool::referenced | ( | PoolData * | pData | ) | [virtual] |
Implements tuttle::host::memory::IPool.
Definition at line 105 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 122 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 231 of file MemoryPool.cpp.
References _memoryAuthorized, MemoryInfo::_totalRam, getMemoryInfo(), TUTTLE_LOG_DEBUG, and TUTTLE_TRACE.
std::ostream& operator<< | ( | std::ostream & | os, |
const This & | v | ||
) | [friend] |
Definition at line 318 of file MemoryPool.cpp.
boost::ptr_list<PoolData> tuttle::host::memory::MemoryPool::_allDatas [private] |
Definition at line 69 of file MemoryPool.hpp.
Referenced by referenced().
std::map<char*, PoolData*> tuttle::host::memory::MemoryPool::_dataMap [private] |
Definition at line 70 of file MemoryPool.hpp.
Referenced by referenced().
Definition at line 72 of file MemoryPool.hpp.
Referenced by clear(), clearOne(), getAllocatedAndUnusedMemorySize(), getDataUnusedSize(), getOneAvailableData(), referenced(), and released().
Definition at line 71 of file MemoryPool.hpp.
Referenced by getDataUsedSize(), getUsedMemorySize(), getWastedMemorySize(), referenced(), released(), and ~MemoryPool().
std::size_t tuttle::host::memory::MemoryPool::_memoryAuthorized [private] |
Definition at line 73 of file MemoryPool.hpp.
Referenced by getMaxMemorySize(), and updateMemoryAuthorizedWithRAM().
boost::mutex tuttle::host::memory::MemoryPool::_mutex [mutable, private] |
Definition at line 74 of file MemoryPool.hpp.
Referenced by clear(), clearOne(), getAllocatedAndUnusedMemorySize(), getOneAvailableData(), getUsedMemorySize(), getWastedMemorySize(), referenced(), and released().