Resolved conflicts
This commit is contained in:
commit
d03fb91b0a
82 changed files with 3489 additions and 439 deletions
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
#include "backend/cpu/Cpu.h"
|
||||
|
@ -44,20 +44,9 @@ xmrig::Controller::~Controller()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Controller::isReady() const
|
||||
{
|
||||
return Base::isReady() && m_network;
|
||||
}
|
||||
|
||||
|
||||
int xmrig::Controller::init()
|
||||
{
|
||||
Cpu::init();
|
||||
|
||||
const int rc = Base::init();
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
Base::init();
|
||||
|
||||
m_network = new Network(this);
|
||||
return 0;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
|
||||
#include "base/kernel/Base.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -40,10 +41,11 @@ class Network;
|
|||
class Controller : public Base
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Controller)
|
||||
|
||||
Controller(Process *process);
|
||||
~Controller() override;
|
||||
|
||||
bool isReady() const override;
|
||||
int init() override;
|
||||
void pre_start();
|
||||
void start() override;
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
bool isEnabled(const Algorithm &algorithm) const
|
||||
{
|
||||
for (IBackend *backend : backends) {
|
||||
if (backend->isEnabled(algorithm)) {
|
||||
if (backend->isEnabled() && backend->isEnabled(algorithm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,11 +35,16 @@ namespace xmrig
|
|||
static const char *kAffinity = "affinity";
|
||||
static const char *kAsterisk = "*";
|
||||
static const char *kCpu = "cpu";
|
||||
static const char *kEnabled = "enabled";
|
||||
static const char *kIntensity = "intensity";
|
||||
static const char *kThreads = "threads";
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
static const char *kRandomX = "randomx";
|
||||
static const char *kRandomX = "randomx";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
static const char *kOcl = "opencl";
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -80,12 +85,7 @@ static inline bool isHwAes(uint64_t av)
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
xmrig::ConfigTransform::ConfigTransform() : BaseTransform()
|
||||
{
|
||||
}
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
void xmrig::ConfigTransform::finalize(rapidjson::Document &doc)
|
||||
|
@ -109,6 +109,12 @@ void xmrig::ConfigTransform::finalize(rapidjson::Document &doc)
|
|||
|
||||
doc[kCpu].AddMember(StringRef(kAsterisk), profile, doc.GetAllocator());
|
||||
}
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
if (m_opencl) {
|
||||
set(doc, kOcl, kEnabled, true);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,6 +129,7 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
|||
return transformUint64(doc, key, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
||||
|
||||
case IConfig::HugePagesKey: /* --no-huge-pages */
|
||||
case IConfig::CPUKey: /* --no-cpu */
|
||||
return transformBoolean(doc, key, false);
|
||||
|
||||
case IConfig::CPUAffinityKey: /* --cpu-affinity */
|
||||
|
@ -131,7 +138,10 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
|||
return transformUint64(doc, key, p ? strtoull(p, nullptr, 16) : strtoull(arg, nullptr, 10));
|
||||
}
|
||||
|
||||
# ifndef XMRIG_NO_ASM
|
||||
case IConfig::CPUMaxThreadsKey: /* --cpu-max-threads-hint */
|
||||
return set(doc, kCpu, "max-threads-hint", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
||||
|
||||
# ifdef XMRIG_FEATURE_ASM
|
||||
case IConfig::AssemblyKey: /* --asm */
|
||||
return set(doc, kCpu, "asm", arg);
|
||||
# endif
|
||||
|
@ -144,6 +154,29 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
|||
return set(doc, kRandomX, "numa", false);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
case IConfig::OclKey: /* --opencl */
|
||||
m_opencl = true;
|
||||
break;
|
||||
|
||||
case IConfig::OclCacheKey: /* --opencl-no-cache */
|
||||
return set(doc, kOcl, "cache", false);
|
||||
|
||||
case IConfig::OclLoaderKey: /* --opencl-loader */
|
||||
return set(doc, kOcl, "loader", arg);
|
||||
|
||||
case IConfig::OclDevicesKey: /* --opencl-devices */
|
||||
m_opencl = true;
|
||||
return set(doc, kOcl, "devices-hint", arg);
|
||||
|
||||
case IConfig::OclPlatformKey: /* --opencl-platform */
|
||||
if (strlen(arg) < 3) {
|
||||
return set(doc, kOcl, "platform", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
||||
}
|
||||
|
||||
return set(doc, kOcl, "platform", arg);
|
||||
# endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -156,6 +189,9 @@ void xmrig::ConfigTransform::transformBoolean(rapidjson::Document &doc, int key,
|
|||
case IConfig::HugePagesKey: /* --no-huge-pages */
|
||||
return set(doc, kCpu, "huge-pages", enable);
|
||||
|
||||
case IConfig::CPUKey: /* --no-cpu */
|
||||
return set(doc, kCpu, kEnabled, enable);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -34,9 +34,6 @@ namespace xmrig {
|
|||
|
||||
class ConfigTransform : public BaseTransform
|
||||
{
|
||||
public:
|
||||
ConfigTransform();
|
||||
|
||||
protected:
|
||||
void finalize(rapidjson::Document &doc) override;
|
||||
void transform(rapidjson::Document &doc, int key, const char *arg) override;
|
||||
|
@ -45,6 +42,7 @@ private:
|
|||
void transformBoolean(rapidjson::Document &doc, int key, bool enable);
|
||||
void transformUint64(rapidjson::Document &doc, int key, uint64_t arg);
|
||||
|
||||
bool m_opencl = false;
|
||||
int64_t m_affinity = -1;
|
||||
uint64_t m_intensity = 1;
|
||||
uint64_t m_threads = 0;
|
||||
|
|
|
@ -57,13 +57,14 @@ R"===(
|
|||
"huge-pages": true,
|
||||
"hw-aes": null,
|
||||
"priority": null,
|
||||
"max-threads-hint": 100,
|
||||
"asm": true,
|
||||
"argon2-impl": null,
|
||||
"cn/0": false,
|
||||
"cn-lite/0": false
|
||||
},
|
||||
"opencl": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"cache": true,
|
||||
"loader": null,
|
||||
"platform": "AMD",
|
||||
|
@ -76,6 +77,7 @@ R"===(
|
|||
"pools": [
|
||||
{
|
||||
"algo": null,
|
||||
"coin": null,
|
||||
"url": "donate.v2.xmrig.com:3333",
|
||||
"user": "YOUR_WALLET_ADDRESS",
|
||||
"pass": "x",
|
||||
|
|
|
@ -45,6 +45,8 @@ static const char short_options[] = "a:c:kBp:Px:r:R:s:t:T:o:u:O:v:l:S";
|
|||
|
||||
static const option options[] = {
|
||||
{ "algo", 1, nullptr, IConfig::AlgorithmKey },
|
||||
{ "coin", 1, nullptr, IConfig::CoinKey },
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
{ "api-worker-id", 1, nullptr, IConfig::ApiWorkerIdKey },
|
||||
{ "api-id", 1, nullptr, IConfig::ApiIdKey },
|
||||
{ "http-enabled", 0, nullptr, IConfig::HttpEnabledKey },
|
||||
|
@ -52,6 +54,9 @@ static const option options[] = {
|
|||
{ "http-access-token", 1, nullptr, IConfig::HttpAccessTokenKey },
|
||||
{ "http-port", 1, nullptr, IConfig::HttpPort },
|
||||
{ "http-no-restricted", 0, nullptr, IConfig::HttpRestrictedKey },
|
||||
{ "daemon", 0, nullptr, IConfig::DaemonKey },
|
||||
{ "daemon-poll-interval", 1, nullptr, IConfig::DaemonPollKey },
|
||||
# endif
|
||||
{ "av", 1, nullptr, IConfig::AVKey },
|
||||
{ "background", 0, nullptr, IConfig::BackgroundKey },
|
||||
{ "config", 1, nullptr, IConfig::ConfigKey },
|
||||
|
@ -63,6 +68,8 @@ static const option options[] = {
|
|||
{ "keepalive", 0, nullptr, IConfig::KeepAliveKey },
|
||||
{ "log-file", 1, nullptr, IConfig::LogFileKey },
|
||||
{ "nicehash", 0, nullptr, IConfig::NicehashKey },
|
||||
{ "rebench-algo", 0, nullptr, IConfig::RebenchAlgoKey },
|
||||
{ "bench-algo-time", 1, nullptr, IConfig::BenchAlgoTimeKey },
|
||||
{ "no-color", 0, nullptr, IConfig::ColorKey },
|
||||
{ "no-huge-pages", 0, nullptr, IConfig::HugePagesKey },
|
||||
{ "pass", 1, nullptr, IConfig::PasswordKey },
|
||||
|
@ -76,15 +83,27 @@ static const option options[] = {
|
|||
{ "user-agent", 1, nullptr, IConfig::UserAgentKey },
|
||||
{ "userpass", 1, nullptr, IConfig::UserpassKey },
|
||||
{ "rig-id", 1, nullptr, IConfig::RigIdKey },
|
||||
{ "no-cpu", 0, nullptr, IConfig::CPUKey },
|
||||
{ "max-cpu-usage", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
||||
{ "cpu-max-threads-hint", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
{ "tls", 0, nullptr, IConfig::TlsKey },
|
||||
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },
|
||||
# endif
|
||||
# ifdef XMRIG_FEATURE_ASM
|
||||
{ "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 },
|
||||
# endif
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
{ "randomx-init", 1, nullptr, IConfig::RandomXInitKey },
|
||||
{ "randomx-no-numa", 0, nullptr, IConfig::RandomXNumaKey },
|
||||
# endif
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
{ "opencl", 0, nullptr, IConfig::OclKey },
|
||||
{ "opencl-devices", 1, nullptr, IConfig::OclDevicesKey },
|
||||
{ "opencl-platform", 1, nullptr, IConfig::OclPlatformKey },
|
||||
{ "opencl-loader", 1, nullptr, IConfig::OclLoaderKey },
|
||||
{ "opencl-no-cache", 0, nullptr, IConfig::OclCacheKey },
|
||||
# endif
|
||||
{ nullptr, 0, nullptr, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -29,99 +29,106 @@
|
|||
#include "version.h"
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static char const usage[] = "\
|
||||
Usage: " APP_ID " [OPTIONS]\n\
|
||||
Options:\n\
|
||||
-a, --algo=ALGO specify the algorithm to use\n\
|
||||
cn/r, cn/2, cn/1, cn/0, cn/double, cn/half, cn/fast,\n\
|
||||
cn/rwz, cn/zls, cn/xao, cn/rto"
|
||||
#ifdef XMRIG_ALGO_CN_GPU
|
||||
", cn/gpu,\n"
|
||||
#else
|
||||
",\n"
|
||||
#endif
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
"\
|
||||
cn-lite/1,\n"
|
||||
#endif
|
||||
#ifdef XMRIG_ALGO_CN_HEAVY
|
||||
"\
|
||||
cn-heavy/xhv, cn-heavy/tube, cn-heavy/0,\n"
|
||||
#endif
|
||||
#ifdef XMRIG_ALGO_CN_PICO
|
||||
"\
|
||||
cn-pico,\n"
|
||||
#endif
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
"\
|
||||
rx/wow, rx/loki, defyx\n"
|
||||
#endif
|
||||
"\
|
||||
-o, --url=URL URL of mining server\n\
|
||||
-O, --userpass=U:P username:password pair for mining server\n\
|
||||
-u, --user=USERNAME username for mining server\n\
|
||||
-p, --pass=PASSWORD password for mining server\n\
|
||||
--rig-id=ID rig identifier for pool-side statistics (needs pool support)\n\
|
||||
-t, --threads=N number of miner threads\n\
|
||||
-v, --av=N algorithm variation, 0 auto select\n\
|
||||
-k, --keepalive send keepalived packet for prevent timeout (needs pool support)\n\
|
||||
--nicehash enable nicehash.com support\n"
|
||||
#ifdef XMRIG_FEATURE_TLS
|
||||
"\
|
||||
--tls enable SSL/TLS support (needs pool support)\n\
|
||||
--tls-fingerprint=F pool TLS certificate fingerprint, if set enable strict certificate pinning\n"
|
||||
#endif
|
||||
#ifdef XMRIG_FEATURE_HTTP
|
||||
"\
|
||||
--daemon use daemon RPC instead of pool for solo mining\n\
|
||||
--daemon-poll-interval=N daemon poll interval in milliseconds (default: 1000)\n"
|
||||
#endif
|
||||
"\
|
||||
-r, --retries=N number of times to retry before switch to backup server (default: 5)\n\
|
||||
-R, --retry-pause=N time to pause between retries (default: 5)\n\
|
||||
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n\
|
||||
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n\
|
||||
--no-huge-pages disable huge pages support\n\
|
||||
--no-color disable colored output\n\
|
||||
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\
|
||||
--user-agent set custom user-agent string for pool\n\
|
||||
-B, --background run the miner in the background\n\
|
||||
-c, --config=FILE load a JSON-format configuration file\n\
|
||||
-l, --log-file=FILE log all output to a file\n"
|
||||
# ifdef HAVE_SYSLOG_H
|
||||
"\
|
||||
-S, --syslog use system log for output messages\n"
|
||||
# endif
|
||||
"\
|
||||
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer.\n\
|
||||
--print-time=N print hashrate report every N seconds\n"
|
||||
#ifdef XMRIG_FEATURE_HTTP
|
||||
"\
|
||||
--api-worker-id=ID custom worker-id for API\n\
|
||||
--api-id=ID custom instance ID for API\n\
|
||||
--http-enabled enable HTTP API\n\
|
||||
--http-host=HOST bind host for HTTP API (default: 127.0.0.1)\n\
|
||||
--http-port=N bind port for HTTP API\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
|
||||
#ifdef XMRIG_FEATURE_HWLOC
|
||||
"\
|
||||
--export-topology export hwloc topology to a XML file and exit\n"
|
||||
#endif
|
||||
"\
|
||||
--dry-run test configuration and exit\n\
|
||||
-h, --help display this help and exit\n\
|
||||
-V, --version output version information and exit\n\
|
||||
";
|
||||
static inline const std::string &usage()
|
||||
{
|
||||
static std::string u;
|
||||
|
||||
if (!u.empty()) {
|
||||
return u;
|
||||
}
|
||||
|
||||
u += "Usage: " APP_ID " [OPTIONS]\n\nNetwork:\n";
|
||||
u += " -o, --url=URL URL of mining server\n";
|
||||
u += " -a, --algo=ALGO mining algorithm https://xmrig.com/docs/algorithms\n";
|
||||
u += " -u, --user=USERNAME username for mining server\n";
|
||||
u += " -p, --pass=PASSWORD password for mining server\n";
|
||||
u += " -O, --userpass=U:P username:password pair for mining server\n";
|
||||
u += " -k, --keepalive send keepalived packet for prevent timeout (needs pool support)\n";
|
||||
u += " --nicehash enable nicehash.com support\n";
|
||||
u += " --rig-id=ID rig identifier for pool-side statistics (needs pool support)\n";
|
||||
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
u += " --tls enable SSL/TLS support (needs pool support)\n";
|
||||
u += " --tls-fingerprint=HEX pool TLS certificate fingerprint for strict certificate pinning\n";
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
u += " --daemon use daemon RPC instead of pool for solo mining\n";
|
||||
u += " --daemon-poll-interval=N daemon poll interval in milliseconds (default: 1000)\n";
|
||||
# endif
|
||||
|
||||
u += " -r, --retries=N number of times to retry before switch to backup server (default: 5)\n";
|
||||
u += " -R, --retry-pause=N time to pause between retries (default: 5)\n";
|
||||
u += " --user-agent set custom user-agent string for pool\n";
|
||||
u += " --donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n";
|
||||
u += " --donate-over-proxy=N control donate over xmrig-proxy feature\n";
|
||||
|
||||
u += "\nCPU backend:\n";
|
||||
|
||||
u += " --no-cpu disable CPU mining backend\n";
|
||||
u += " -t, --threads=N number of CPU threads\n";
|
||||
u += " -v, --av=N algorithm variation, 0 auto select\n";
|
||||
u += " --cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n";
|
||||
u += " --cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n";
|
||||
u += " --cpu-max-threads-hint=N maximum CPU threads count (in percentage) hint for autoconfig\n";
|
||||
u += " --no-huge-pages disable huge pages support\n";
|
||||
u += " --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer\n";
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
u += " --randomx-init=N threads count to initialize RandomX dataset\n";
|
||||
u += " --randomx-no-numa disable NUMA support for RandomX\n";
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
u += "\nAPI:\n";
|
||||
u += " --api-worker-id=ID custom worker-id for API\n";
|
||||
u += " --api-id=ID custom instance ID for API\n";
|
||||
u += " --http-host=HOST bind host for HTTP API (default: 127.0.0.1)\n";
|
||||
u += " --http-port=N bind port for HTTP API\n";
|
||||
u += " --http-access-token=T access token for HTTP API\n";
|
||||
u += " --http-no-restricted enable full remote access to HTTP API (only if access token set)\n";
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
u += "\nOpenCL backend:\n";
|
||||
u += " --opencl enable OpenCL mining backend\n";
|
||||
u += " --opencl-devices=N list of OpenCL devices to use\n";
|
||||
u += " --opencl-platform=N OpenCL platform index or name\n";
|
||||
u += " --opencl-loader=N path to OpenCL-ICD-Loader (OpenCL.dll or libOpenCL.so)\n";
|
||||
u += " --opencl-no-cache disable OpenCL cache\n";
|
||||
u += " --print-platforms print available OpenCL platforms and exit\n";
|
||||
# endif
|
||||
|
||||
u += "\nLogging:\n";
|
||||
|
||||
# ifdef HAVE_SYSLOG_H
|
||||
u += " -S, --syslog use system log for output messages\n";
|
||||
# endif
|
||||
|
||||
u += " -l, --log-file=FILE log all output to a file\n";
|
||||
u += " --print-time=N print hashrate report every N seconds\n";
|
||||
u += " --no-color disable colored output\n";
|
||||
|
||||
u += "\nMisc:\n";
|
||||
|
||||
u += " -c, --config=FILE load a JSON-format configuration file\n";
|
||||
u += " -B, --background run the miner in the background\n";
|
||||
u += " -V, --version output version information and exit\n";
|
||||
u += " -h, --help display this help and exit\n";
|
||||
u += " --dry-run test configuration and exit\n";
|
||||
|
||||
# ifdef XMRIG_FEATURE_HWLOC
|
||||
u += " --export-topology export hwloc topology to a XML file and exit\n";
|
||||
# endif
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue