1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-27 06:20:51 -05:00

Merge commit

This commit is contained in:
MoneroOcean
2019-07-28 11:38:00 -07:00
100 changed files with 33836 additions and 231 deletions

View File

@@ -38,6 +38,17 @@
#include "rapidjson/prettywriter.h"
namespace xmrig {
static const char *kCPU = "cpu";
#ifdef XMRIG_ALGO_RANDOMX
static const char *kRandomX = "randomx";
#endif
}
xmrig::Config::Config() : BaseConfig()
{
}
@@ -49,9 +60,15 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
return false;
}
m_cpu.read(reader.getValue("cpu"));
m_cpu.read(reader.getValue(kCPU));
m_benchmark.read(reader.getValue("algo-perf"));
# ifdef XMRIG_ALGO_RANDOMX
if (!m_rx.read(reader.getValue(kRandomX))) {
m_upgrade = true;
}
# endif
return true;
}
@@ -69,14 +86,19 @@ 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("algo-perf", m_benchmark.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);

View File

@@ -35,6 +35,11 @@
#include "rapidjson/fwd.h"
#ifdef XMRIG_ALGO_RANDOMX
# include "crypto/rx/RxConfig.h"
#endif
namespace xmrig {
@@ -53,10 +58,18 @@ public:
inline const CpuConfig &cpu() const { return m_cpu; }
inline Benchmark &benchmark() { return m_benchmark; }
# ifdef XMRIG_ALGO_RANDOMX
inline const RxConfig &rx() const { return m_rx; }
# endif
private:
bool m_shouldSave = false;
CpuConfig m_cpu;
Benchmark m_benchmark;
# ifdef XMRIG_ALGO_RANDOMX
RxConfig m_rx;
# endif
};

View File

@@ -36,6 +36,7 @@ static const char *kAffinity = "affinity";
static const char *kAsterisk = "*";
static const char *kCpu = "cpu";
static const char *kIntensity = "intensity";
static const char *kRandomX = "randomx";
static inline uint64_t intensity(uint64_t av)
@@ -165,6 +166,14 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
return set(doc, kCpu, "asm", arg);
# endif
# ifdef XMRIG_ALGO_RANDOMX
case IConfig::RandomXInitKey: /* --randomx-init */
return set(doc, kRandomX, "init", static_cast<int64_t>(strtol(arg, nullptr, 10)));
case IConfig::RandomXNumaKey: /* --randomx-no-numa */
return set(doc, kRandomX, "numa", false);
# endif
default:
break;
}

View File

@@ -37,9 +37,20 @@ R"===(
"id": null,
"worker-id": null
},
"http": {
"enabled": false,
"host": "127.0.0.1",
"port": 0,
"access-token": null,
"restricted": true
},
"autosave": true,
"background": false,
"colors": true,
"randomx": {
"init": -1,
"numa": true
},
"cpu": {
"enabled": true,
"huge-pages": true,
@@ -51,13 +62,6 @@ R"===(
},
"donate-level": 5,
"donate-over-proxy": 1,
"http": {
"enabled": false,
"host": "127.0.0.1",
"port": 0,
"access-token": null,
"restricted": true
},
"log-file": null,
"pools": [
{

View File

@@ -81,10 +81,10 @@ static const option options[] = {
{ "asm", 1, nullptr, IConfig::AssemblyKey },
{ "daemon", 0, nullptr, IConfig::DaemonKey },
{ "daemon-poll-interval", 1, nullptr, IConfig::DaemonPollKey },
{ "rebench-algo", 0, nullptr, IConfig::RebenchAlgoKey },
{ "bench-algo-time", 1, nullptr, IConfig::BenchAlgoTimeKey },
{ "randomx-init", 1, nullptr, IConfig::RandomXInitKey },
{ "randomx-no-numa", 0, nullptr, IConfig::RandomXNumaKey },
{ nullptr, 0, nullptr, 0 }
};

View File

@@ -108,6 +108,11 @@ Options:\n\
--http-access-token=T access token for HTTP API\n\
--http-no-restricted enable full remote access to HTTP API (only if access token set)\n"
#endif
#ifdef XMRIG_ALGO_RANDOMX
"\
--randomx-init=N threads count to initialize RandomX dataset\n\
--randomx-no-numa disable NUMA support for RandomX\n"
#endif
"\
--dry-run test configuration and exit\n\
-h, --help display this help and exit\n\