Added "randomx" object to config.
This commit is contained in:
parent
9df9275120
commit
d10527036e
8 changed files with 159 additions and 10 deletions
|
@ -365,8 +365,11 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
|
|||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
const CpuConfig &cpu = d_ptr->controller->config()->cpu();
|
||||
Rx::init(job, cpu.initThreads(), cpu.isHugePages(), true);
|
||||
Rx::init(job,
|
||||
d_ptr->controller->config()->rx().threads(),
|
||||
d_ptr->controller->config()->cpu().isHugePages(),
|
||||
d_ptr->controller->config()->rx().isNUMA()
|
||||
);
|
||||
# endif
|
||||
|
||||
uv_rwlock_wrunlock(&d_ptr->rwlock);
|
||||
|
|
|
@ -38,6 +38,14 @@
|
|||
#include "rapidjson/prettywriter.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
static const char *kCPU = "cpu";
|
||||
static const char *kRandomX = "randomx";
|
||||
|
||||
}
|
||||
|
||||
|
||||
xmrig::Config::Config() : BaseConfig()
|
||||
{
|
||||
}
|
||||
|
@ -49,7 +57,14 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
|
|||
return false;
|
||||
}
|
||||
|
||||
m_cpu.read(reader.getValue("cpu"));
|
||||
m_cpu.read(reader.getValue(kCPU));
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (!m_rx.read(reader.getValue(kRandomX))) {
|
||||
printf("upgrade\n");
|
||||
m_upgrade = true;
|
||||
}
|
||||
# endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -68,13 +83,18 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
|||
api.AddMember("worker-id", m_apiWorkerId.toJSON(), allocator);
|
||||
|
||||
doc.AddMember("api", api, allocator);
|
||||
doc.AddMember("http", m_http.toJSON(doc), allocator);
|
||||
doc.AddMember("autosave", isAutoSave(), allocator);
|
||||
doc.AddMember("background", isBackground(), allocator);
|
||||
doc.AddMember("colors", Log::colors, allocator);
|
||||
doc.AddMember("cpu", m_cpu.toJSON(doc), allocator);
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
doc.AddMember(StringRef(kRandomX), m_rx.toJSON(doc), allocator);
|
||||
# endif
|
||||
|
||||
doc.AddMember(StringRef(kCPU), m_cpu.toJSON(doc), allocator);
|
||||
doc.AddMember("donate-level", m_pools.donateLevel(), allocator);
|
||||
doc.AddMember("donate-over-proxy", m_pools.proxyDonate(), allocator);
|
||||
doc.AddMember("http", m_http.toJSON(doc), allocator);
|
||||
doc.AddMember("log-file", m_logFile.toJSON(), allocator);
|
||||
doc.AddMember("pools", m_pools.toJSON(doc), allocator);
|
||||
doc.AddMember("print-time", printTime(), allocator);
|
||||
|
|
|
@ -34,6 +34,11 @@
|
|||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
# include "crypto/rx/RxConfig.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
|
@ -51,9 +56,17 @@ public:
|
|||
inline bool isShouldSave() const { return (m_shouldSave || m_upgrade || m_cpu.isShouldSave()) && isAutoSave(); }
|
||||
inline const CpuConfig &cpu() const { return m_cpu; }
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
inline const RxConfig &rx() const { return m_rx; }
|
||||
# endif
|
||||
|
||||
private:
|
||||
bool m_shouldSave = false;
|
||||
CpuConfig m_cpu;
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
RxConfig m_rx;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue