#include "memory.hpp"
#include <cstdlib>
#include <trans_table/trans_table.hpp>
Memory::Memory()
{
}
Memory::~Memory()
{
Resize(0, DDS_TT_SMALL, 0, 0);
}
void Memory::ReturnThread(const unsigned )
{
}
void Memory::Resize(
const unsigned n,
const TTmemory flag,
const int ,
const int ) {
threadSizes.resize(n);
for (unsigned i = 0; i < n; ++i)
threadSizes[i] = (flag == DDS_TT_SMALL ? "S" : "L");
}
unsigned Memory::NumThreads() const
{
return static_cast<unsigned>(threadSizes.size());
}
double Memory::MemoryInUseMB(const unsigned ) const
{
return 8192. * sizeof(RelRanksType) / static_cast<double>(1024.);
}
std::string Memory::ThreadSize(const unsigned thrId) const
{
if (thrId >= threadSizes.size()) return std::string();
return threadSizes[thrId];
}