Move "1gb-pages" option to "randomx" object.

This commit is contained in:
XMRig 2019-12-09 21:42:40 +07:00
parent 558c524e2a
commit 3edaebb4cf
No known key found for this signature in database
GPG key ID: 446A53638BE94409
8 changed files with 46 additions and 26 deletions

View file

@ -71,7 +71,7 @@ bool xmrig::Rx::init(const Job &job, const RxConfig &config, const CpuConfig &cp
return true;
}
d_ptr->queue.enqueue(job, config.nodeset(), config.threads(cpu.limit()), cpu.isHugePages(), cpu.isOneGbPages(), config.mode(), cpu.priority());
d_ptr->queue.enqueue(job, config.nodeset(), config.threads(cpu.limit()), cpu.isHugePages(), config.isOneGbPages(), config.mode(), cpu.priority());
return false;
}

View file

@ -57,14 +57,16 @@ public:
const char *modeName() const;
uint32_t threads(uint32_t limit = 100) const;
inline Mode mode() const { return m_mode; }
inline bool isOneGbPages() const { return m_oneGbPages; }
inline Mode mode() const { return m_mode; }
private:
Mode readMode(const rapidjson::Value &value) const;
bool m_numa = true;
int m_threads = -1;
Mode m_mode = AutoMode;
bool m_numa = true;
bool m_oneGbPages = false;
int m_threads = -1;
Mode m_mode = AutoMode;
# ifdef XMRIG_FEATURE_HWLOC
std::vector<uint32_t> m_nodeset;

View file

@ -30,8 +30,9 @@
namespace xmrig {
static const char *kInit = "init";
static const char *kMode = "mode";
static const char *kInit = "init";
static const char *kMode = "mode";
static const char *kOneGbPages = "1gb-pages";
}
@ -42,8 +43,9 @@ rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
auto &allocator = doc.GetAllocator();
Value obj(kObjectType);
obj.AddMember(StringRef(kInit), m_threads, allocator);
obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator);
obj.AddMember(StringRef(kInit), m_threads, allocator);
obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator);
obj.AddMember(StringRef(kOneGbPages), m_oneGbPages, allocator);
return obj;
}
@ -52,8 +54,12 @@ rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
bool xmrig::RxConfig::read(const rapidjson::Value &value)
{
if (value.IsObject()) {
m_threads = Json::getInt(value, kInit, m_threads);
m_mode = readMode(Json::getValue(value, kMode));
m_threads = Json::getInt(value, kInit, m_threads);
m_mode = readMode(Json::getValue(value, kMode));
# ifdef XMRIG_OS_LINUX
m_oneGbPages = Json::getBool(value, kOneGbPages, m_oneGbPages);
# endif
return true;
}

View file

@ -32,9 +32,10 @@
namespace xmrig {
static const char *kInit = "init";
static const char *kMode = "mode";
static const char *kNUMA = "numa";
static const char *kInit = "init";
static const char *kMode = "mode";
static const char *kNUMA = "numa";
static const char *kOneGbPages = "1gb-pages";
}
@ -46,8 +47,9 @@ rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
Value obj(kObjectType);
obj.AddMember(StringRef(kInit), m_threads, allocator);
obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator);
obj.AddMember(StringRef(kInit), m_threads, allocator);
obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator);
obj.AddMember(StringRef(kOneGbPages), m_oneGbPages, allocator);
if (!m_nodeset.empty()) {
Value numa(kArrayType);
@ -69,8 +71,12 @@ rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
bool xmrig::RxConfig::read(const rapidjson::Value &value)
{
if (value.IsObject()) {
m_threads = Json::getInt(value, kInit, m_threads);
m_mode = readMode(Json::getValue(value, kMode));
m_threads = Json::getInt(value, kInit, m_threads);
m_mode = readMode(Json::getValue(value, kMode));
# ifdef XMRIG_OS_LINUX
m_oneGbPages = Json::getBool(value, kOneGbPages, m_oneGbPages);
# endif
if (m_mode == LightMode) {
m_numa = false;