Extended "numa" option for RandomX.

This commit is contained in:
XMRig 2019-10-04 10:49:55 +07:00
parent f34031a984
commit 7508411faf
8 changed files with 189 additions and 55 deletions

View file

@ -25,51 +25,6 @@
#include "crypto/rx/RxConfig.h"
#include "backend/cpu/Cpu.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
namespace xmrig {
static const char *kInit = "init";
static const char *kNUMA = "numa";
}
rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
{
using namespace rapidjson;
auto &allocator = doc.GetAllocator();
Value obj(kObjectType);
obj.AddMember(StringRef(kInit), m_threads, allocator);
obj.AddMember(StringRef(kNUMA), m_numa, allocator);
return obj;
}
bool xmrig::RxConfig::read(const rapidjson::Value &value)
{
if (value.IsObject()) {
m_numa = Json::getBool(value, kNUMA, m_numa);
m_threads = Json::getInt(value, kInit, m_threads);
return true;
}
return false;
}
#ifdef XMRIG_FEATURE_HWLOC
bool xmrig::RxConfig::isNUMA() const
{
return m_numa && Cpu::info()->nodes() > 1;
}
#endif
uint32_t xmrig::RxConfig::threads() const