xmrig v6.3.1 merge

This commit is contained in:
MoneroOcean 2020-07-31 12:04:00 -07:00
commit 22c39226b0
37 changed files with 308 additions and 251 deletions

View file

@ -287,6 +287,7 @@ public:
bool active = false;
bool enabled = true;
bool reset = true;
bool battery_power = false;
Controller *controller;
Job job;
mutable std::map<Algorithm::Id, double> maxHashrate;
@ -429,13 +430,24 @@ void xmrig::Miner::setEnabled(bool enabled)
return;
}
if (d_ptr->battery_power && enabled) {
LOG_INFO("%s " YELLOW_BOLD("can't resume while on battery power"), Tags::miner());
return;
}
d_ptr->enabled = enabled;
if (enabled) {
LOG_INFO(GREEN_BOLD("resumed"));
LOG_INFO("%s " GREEN_BOLD("resumed"), Tags::miner());
}
else {
LOG_INFO(YELLOW_BOLD("paused") ", press " MAGENTA_BG_BOLD(" r ") " to resume");
if (d_ptr->battery_power) {
LOG_INFO("%s " YELLOW_BOLD("paused"), Tags::miner());
}
else {
LOG_INFO("%s " YELLOW_BOLD("paused") ", press " MAGENTA_BG_BOLD(" r ") " to resume", Tags::miner());
}
}
if (!d_ptr->active) {
@ -538,6 +550,20 @@ void xmrig::Miner::onTimer(const Timer *)
}
d_ptr->ticks++;
if (d_ptr->controller->config()->isPauseOnBattery()) {
const bool battery_power = Platform::isOnBatteryPower();
if (battery_power && d_ptr->enabled) {
LOG_INFO("%s " YELLOW_BOLD("on battery power"), Tags::miner());
d_ptr->battery_power = true;
setEnabled(false);
}
else if (!battery_power && !d_ptr->enabled && d_ptr->battery_power) {
LOG_INFO("%s " GREEN_BOLD("on AC power"), Tags::miner());
d_ptr->battery_power = false;
setEnabled(true);
}
}
}

View file

@ -268,4 +268,6 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember(StringRef(kBenchAlgoTime), benchAlgoTime(), allocator);
doc.AddMember(StringRef(kAlgoPerf), m_benchmark.toJSON(doc), allocator);
# endif
doc.AddMember(StringRef(kPauseOnBattery), isPauseOnBattery(), allocator);
}

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -151,6 +151,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
case IConfig::YieldKey: /* --cpu-no-yield */
return set(doc, kCpu, "yield", false);
case IConfig::Argon2ImplKey: /* --argon2-impl */
return set(doc, kCpu, "argon2-impl", arg);
# ifdef XMRIG_FEATURE_ASM
case IConfig::AssemblyKey: /* --asm */
return set(doc, kCpu, "asm", arg);
@ -186,6 +189,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
case IConfig::RandomXRdmsrKey: /* --randomx-no-rdmsr */
return set(doc, kRandomX, "rdmsr", false);
case IConfig::RandomXCacheQoSKey: /* --cache-qos */
return set(doc, kRandomX, "cache_qos", true);
# endif
# ifdef XMRIG_FEATURE_OPENCL

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -109,7 +109,8 @@ R"===(
"retry-pause": 5,
"syslog": false,
"user-agent": null,
"watch": true
"watch": true,
"pause-on-battery": false
}
)===";
#endif

View file

@ -89,11 +89,15 @@ static const option options[] = {
{ "cpu-max-threads-hint", 1, nullptr, IConfig::CPUMaxThreadsKey },
{ "cpu-memory-pool", 1, nullptr, IConfig::MemoryPoolKey },
{ "cpu-no-yield", 0, nullptr, IConfig::YieldKey },
{ "no-yield", 0, nullptr, IConfig::YieldKey },
{ "cpu-argon2-impl", 1, nullptr, IConfig::Argon2ImplKey },
{ "argon2-impl", 1, nullptr, IConfig::Argon2ImplKey },
{ "verbose", 0, nullptr, IConfig::VerboseKey },
{ "proxy", 1, nullptr, IConfig::ProxyKey },
{ "data-dir", 1, nullptr, IConfig::DataDirKey },
{ "title", 1, nullptr, IConfig::TitleKey },
{ "no-title", 0, nullptr, IConfig::NoTitleKey },
{ "pause-on-battery", 0, nullptr, IConfig::PauseOnBatteryKey },
# ifdef XMRIG_FEATURE_TLS
{ "tls", 0, nullptr, IConfig::TlsKey },
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },
@ -118,6 +122,8 @@ static const option options[] = {
{ "wrmsr", 2, nullptr, IConfig::RandomXWrmsrKey },
{ "randomx-no-rdmsr", 0, nullptr, IConfig::RandomXRdmsrKey },
{ "no-rdmsr", 0, nullptr, IConfig::RandomXRdmsrKey },
{ "randomx-cache-qos", 0, nullptr, IConfig::RandomXCacheQoSKey },
{ "cache-qos", 0, nullptr, IConfig::RandomXCacheQoSKey },
# endif
#ifdef XMRIG_ALGO_ASTROBWT
{ "astrobwt-max-size", 1, nullptr, IConfig::AstroBWTMaxSizeKey },

View file

@ -69,7 +69,7 @@ static inline const std::string &usage()
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-level=N donate level, default 1%% (1 minute in 100 minutes)\n";
u += " --donate-over-proxy=N control donate over xmrig-proxy feature\n";
u += "\nCPU backend:\n";
@ -85,13 +85,18 @@ static inline const std::string &usage()
u += " --no-huge-pages disable huge pages support\n";
u += " --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer\n";
# if defined(__x86_64__) || defined(_M_AMD64)
u += " --argon2-impl=IMPL argon2 implementation: x86_64, SSE2, SSSE3, XOP, AVX2, AVX-512F\n";
# endif
# 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";
u += " --randomx-mode=MODE RandomX mode: auto, fast, light\n";
u += " --randomx-1gb-pages use 1GB hugepages for dataset (Linux only)\n";
u += " --randomx-wrmsr=N write custom value (0-15) to Intel MSR register 0x1a4 or disable MSR mod (-1)\n";
u += " --randomx-1gb-pages use 1GB hugepages for RandomX dataset (Linux only)\n";
u += " --randomx-wrmsr=N write custom value(s) to MSR registers or disable MSR mod (-1)\n";
u += " --randomx-no-rdmsr disable reverting initial MSR values on exit\n";
u += " --randomx-cache-qos enable Cache QoS\n";
# endif
# ifdef XMRIG_ALGO_ASTROBWT
@ -99,16 +104,6 @@ static inline const std::string &usage()
u += " --astrobwt-avx2 enable AVX2 optimizations for AstroBWT algorithm";
# 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";
@ -131,6 +126,16 @@ static inline const std::string &usage()
u += " --no-nvml disable NVML (NVIDIA Management Library) support\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_TLS
u += "\nTLS:\n";
u += " --tls-gen=HOSTNAME generate TLS certificate for specific hostname\n";
@ -172,6 +177,7 @@ static inline const std::string &usage()
u += " --title set custom console window title\n";
u += " --no-title disable setting console window title\n";
# endif
u += " --pause-on-battery pause mine on battery power\n";
return u;
}