Merge remote-tracking branch 'remotes/origin/sync-base' into evo
This commit is contained in:
commit
f6dbe32c86
227 changed files with 80367 additions and 12475 deletions
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
@ -20,7 +20,7 @@
|
|||
#define XMRIG_CONTROLLER_H
|
||||
|
||||
|
||||
#include "base/kernel/Base.h"
|
||||
#include "base/kernel/v6/Base.h"
|
||||
|
||||
|
||||
#include <memory>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
@ -28,7 +28,9 @@
|
|||
#include "backend/cpu/CpuBackend.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "base/kernel/OS.h"
|
||||
#include "base/kernel/Process.h"
|
||||
#include "base/kernel/Taskbar.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "base/tools/Timer.h"
|
||||
|
@ -61,8 +63,8 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_ASTROBWT
|
||||
# include "crypto/astrobwt/AstroBWT.h"
|
||||
#ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
# include "crypto/ghostrider/ghostrider.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -148,7 +150,7 @@ public:
|
|||
|
||||
reply.AddMember("version", APP_VERSION, allocator);
|
||||
reply.AddMember("kind", APP_KIND, allocator);
|
||||
reply.AddMember("ua", Platform::userAgent().toJSON(), allocator);
|
||||
reply.AddMember("ua", Process::userAgent().toJSON(), allocator);
|
||||
reply.AddMember("cpu", Cpu::toJSON(doc), allocator);
|
||||
reply.AddMember("donate_level", controller->config()->pools().donateLevel(), allocator);
|
||||
reply.AddMember("paused", !enabled, allocator);
|
||||
|
@ -281,10 +283,12 @@ public:
|
|||
|
||||
void printHashrate(bool details)
|
||||
{
|
||||
char num[16 * 4] = { 0 };
|
||||
char num[16 * 5] = { 0 };
|
||||
double speed[3] = { 0.0 };
|
||||
uint32_t count = 0;
|
||||
|
||||
double avg_hashrate = 0.0;
|
||||
|
||||
for (auto backend : backends) {
|
||||
const auto hashrate = backend->hashrate();
|
||||
if (hashrate) {
|
||||
|
@ -293,6 +297,8 @@ public:
|
|||
speed[0] += hashrate->calc(Hashrate::ShortInterval);
|
||||
speed[1] += hashrate->calc(Hashrate::MediumInterval);
|
||||
speed[2] += hashrate->calc(Hashrate::LargeInterval);
|
||||
|
||||
avg_hashrate += hashrate->average();
|
||||
}
|
||||
|
||||
backend->printHashrate(details);
|
||||
|
@ -312,12 +318,22 @@ public:
|
|||
h = "MH/s";
|
||||
}
|
||||
|
||||
LOG_INFO("%s " WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("%s") " max " CYAN_BOLD("%s %s"),
|
||||
char avg_hashrate_buf[64];
|
||||
avg_hashrate_buf[0] = '\0';
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
if (algorithm.family() == Algorithm::GHOSTRIDER) {
|
||||
snprintf(avg_hashrate_buf, sizeof(avg_hashrate_buf), " avg " CYAN_BOLD("%s %s"), Hashrate::format(avg_hashrate * scale, num + 16 * 4, 16), h);
|
||||
}
|
||||
# endif
|
||||
|
||||
LOG_INFO("%s " WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("%s") " max " CYAN_BOLD("%s %s") "%s",
|
||||
Tags::miner(),
|
||||
Hashrate::format(speed[0] * scale, num, sizeof(num) / 4),
|
||||
Hashrate::format(speed[1] * scale, num + 16, sizeof(num) / 4),
|
||||
Hashrate::format(speed[2] * scale, num + 16 * 2, sizeof(num) / 4), h,
|
||||
Hashrate::format(maxHashrate[algorithm] * scale, num + 16 * 3, sizeof(num) / 4), h
|
||||
Hashrate::format(speed[0] * scale, num, 16),
|
||||
Hashrate::format(speed[1] * scale, num + 16, 16),
|
||||
Hashrate::format(speed[2] * scale, num + 16 * 2, 16), h,
|
||||
Hashrate::format(maxHashrate[algorithm] * scale, num + 16 * 3, 16), h,
|
||||
avg_hashrate_buf
|
||||
);
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
|
@ -333,6 +349,11 @@ public:
|
|||
# endif
|
||||
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
inline void initGhostRider() const { ghostrider::benchmark(); }
|
||||
# endif
|
||||
|
||||
|
||||
Algorithm algorithm;
|
||||
Algorithms algorithms;
|
||||
bool active = false;
|
||||
|
@ -348,6 +369,8 @@ public:
|
|||
String userJobId;
|
||||
Timer *timer = nullptr;
|
||||
uint64_t ticks = 0;
|
||||
|
||||
Taskbar m_taskbar;
|
||||
};
|
||||
|
||||
|
||||
|
@ -360,8 +383,8 @@ xmrig::Miner::Miner(Controller *controller)
|
|||
{
|
||||
const int priority = controller->config()->cpu().priority();
|
||||
if (priority >= 0) {
|
||||
Platform::setProcessPriority(priority);
|
||||
Platform::setThreadPriority(std::min(priority + 1, 5));
|
||||
OS::setProcessPriority(priority);
|
||||
OS::setThreadPriority(std::min(priority + 1, 5));
|
||||
}
|
||||
|
||||
# ifdef XMRIG_FEATURE_PROFILING
|
||||
|
@ -372,10 +395,6 @@ xmrig::Miner::Miner(Controller *controller)
|
|||
Rx::init(this);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_ASTROBWT
|
||||
astrobwt::init();
|
||||
# endif
|
||||
|
||||
controller->addListener(this);
|
||||
|
||||
# ifdef XMRIG_FEATURE_API
|
||||
|
@ -475,6 +494,7 @@ void xmrig::Miner::execCommand(char command)
|
|||
void xmrig::Miner::pause()
|
||||
{
|
||||
d_ptr->active = false;
|
||||
// d_ptr->m_taskbar.setActive(false); // FIXME
|
||||
|
||||
Nonce::pause(true);
|
||||
Nonce::touch();
|
||||
|
@ -487,13 +507,14 @@ void xmrig::Miner::setEnabled(bool enabled)
|
|||
return;
|
||||
}
|
||||
|
||||
if (d_ptr->battery_power && enabled) {
|
||||
if (d_ptr->controller->config()->isPauseOnBattery() && d_ptr->battery_power && enabled) {
|
||||
LOG_INFO("%s " YELLOW_BOLD("can't resume while on battery power"), Tags::miner());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
d_ptr->enabled = enabled;
|
||||
// d_ptr->m_taskbar.setEnabled(enabled); // FIXME
|
||||
|
||||
if (enabled) {
|
||||
LOG_INFO("%s " GREEN_BOLD("resumed"), Tags::miner());
|
||||
|
@ -524,7 +545,13 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
|
|||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) {
|
||||
stop();
|
||||
if (d_ptr->algorithm != job.algorithm()) {
|
||||
stop();
|
||||
}
|
||||
else {
|
||||
Nonce::pause(true);
|
||||
Nonce::touch();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
|
@ -548,9 +575,16 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
|
|||
constexpr const bool ready = true;
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
if (job.algorithm().family() == Algorithm::GHOSTRIDER) {
|
||||
d_ptr->initGhostRider();
|
||||
}
|
||||
# endif
|
||||
|
||||
mutex.unlock();
|
||||
|
||||
d_ptr->active = true;
|
||||
// d_ptr->m_taskbar.setActive(true); // FIXME
|
||||
|
||||
if (ready) {
|
||||
d_ptr->handleJobChange();
|
||||
|
@ -627,11 +661,11 @@ void xmrig::Miner::onTimer(const Timer *)
|
|||
};
|
||||
|
||||
if (config->isPauseOnBattery()) {
|
||||
autoPause(d_ptr->battery_power, Platform::isOnBatteryPower(), YELLOW_BOLD("on battery power"), GREEN_BOLD("on AC power"));
|
||||
autoPause(d_ptr->battery_power, OS::isOnBatteryPower(), YELLOW_BOLD("on battery power"), GREEN_BOLD("on AC power"));
|
||||
}
|
||||
|
||||
if (config->isPauseOnActive()) {
|
||||
autoPause(d_ptr->user_active, Platform::isUserActive(config->idleTime()), YELLOW_BOLD("user active"), GREEN_BOLD("user inactive"));
|
||||
autoPause(d_ptr->user_active, OS::isUserActive(config->idleTime()), YELLOW_BOLD("user active"), GREEN_BOLD("user inactive"));
|
||||
}
|
||||
|
||||
if (stopMiner) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/interfaces/IJsonReader.h"
|
||||
#include "base/kernel/private/DnsConfig.h"
|
||||
#include "base/net/dns/Dns.h"
|
||||
#include "crypto/common/Assembly.h"
|
||||
|
||||
|
@ -297,7 +298,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
|||
doc.AddMember(StringRef(kTls), m_tls.toJSON(doc), allocator);
|
||||
# endif
|
||||
|
||||
doc.AddMember(StringRef(DnsConfig::kField), Dns::config().toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(DnsConfig::kField), DnsConfig::current().toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kUserAgent), m_userAgent.toJSON(), allocator);
|
||||
doc.AddMember(StringRef(kVerbose), Log::verbose(), allocator);
|
||||
doc.AddMember(StringRef(kWatch), m_watch, allocator);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
@ -25,8 +25,7 @@
|
|||
|
||||
#include "3rdparty/rapidjson/fwd.h"
|
||||
#include "backend/cpu/CpuConfig.h"
|
||||
#include "base/kernel/config/BaseConfig.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "base/kernel/v6/config/BaseConfig.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "core/config/ConfigTransform.h"
|
||||
#include "base/crypto/Algorithm.h"
|
||||
#include "base/kernel/interfaces/IConfig.h"
|
||||
#include "base/net/stratum/Pool.h"
|
||||
#include "base/net/stratum/Pools.h"
|
||||
|
@ -102,6 +103,9 @@ void xmrig::ConfigTransform::finalize(rapidjson::Document &doc)
|
|||
profile.AddMember(StringRef(kThreads), m_threads, allocator);
|
||||
profile.AddMember(StringRef(kAffinity), m_affinity, allocator);
|
||||
|
||||
# ifdef XMRIG_ALGO_KAWPOW
|
||||
doc[CpuConfig::kField].AddMember(StringRef(Algorithm::kKAWPOW), false, doc.GetAllocator());
|
||||
# endif
|
||||
doc[CpuConfig::kField].AddMember(StringRef(kAsterisk), profile, doc.GetAllocator());
|
||||
}
|
||||
|
||||
|
@ -159,14 +163,6 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
|||
return set(doc, CpuConfig::kField, CpuConfig::kAsm, arg);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_ASTROBWT
|
||||
case IConfig::AstroBWTMaxSizeKey: /* --astrobwt-max-size */
|
||||
return set(doc, CpuConfig::kField, CpuConfig::kAstroBWTMaxSize, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
||||
|
||||
case IConfig::AstroBWTAVX2Key: /* --astrobwt-avx2 */
|
||||
return set(doc, CpuConfig::kField, CpuConfig::kAstroBWTAVX2, true);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
case IConfig::RandomXInitKey: /* --randomx-init */
|
||||
return set(doc, RxConfig::kField, RxConfig::kInit, static_cast<int64_t>(strtol(arg, nullptr, 10)));
|
||||
|
@ -265,6 +261,7 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
|||
case IConfig::BenchSeedKey: /* --seed */
|
||||
case IConfig::BenchHashKey: /* --hash */
|
||||
case IConfig::UserKey: /* --user */
|
||||
case IConfig::RotationKey: /* --rotation */
|
||||
return transformBenchmark(doc, key, arg);
|
||||
# endif
|
||||
|
||||
|
@ -322,16 +319,18 @@ void xmrig::ConfigTransform::transformUint64(rapidjson::Document &doc, int key,
|
|||
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||
void xmrig::ConfigTransform::transformBenchmark(rapidjson::Document &doc, int key, const char *arg)
|
||||
{
|
||||
set(doc, CpuConfig::kField, CpuConfig::kHugePagesJit, true);
|
||||
set(doc, CpuConfig::kField, CpuConfig::kPriority, 2);
|
||||
set(doc, CpuConfig::kField, CpuConfig::kYield, false);
|
||||
|
||||
switch (key) {
|
||||
case IConfig::AlgorithmKey: /* --algo */
|
||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kAlgo, arg);
|
||||
|
||||
case IConfig::BenchKey: /* --bench */
|
||||
{
|
||||
// CPU settings for the benchmark
|
||||
set(doc, CpuConfig::kField, CpuConfig::kHugePagesJit, true);
|
||||
set(doc, CpuConfig::kField, CpuConfig::kPriority, 2);
|
||||
set(doc, CpuConfig::kField, CpuConfig::kYield, false);
|
||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kSize, arg);
|
||||
}
|
||||
|
||||
case IConfig::StressKey: /* --stress */
|
||||
return add(doc, Pools::kPools, Pool::kUser, BenchConfig::kBenchmark);
|
||||
|
@ -354,6 +353,9 @@ void xmrig::ConfigTransform::transformBenchmark(rapidjson::Document &doc, int ke
|
|||
case IConfig::UserKey: /* --user */
|
||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kUser, arg);
|
||||
|
||||
case IConfig::RotationKey: /* --rotation */
|
||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kRotation, arg);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
|
@ -20,7 +20,7 @@
|
|||
#define XMRIG_CONFIGTRANSFORM_H
|
||||
|
||||
|
||||
#include "base/kernel/config/BaseTransform.h"
|
||||
#include "base/kernel/v6/config/BaseTransform.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
|
|
@ -66,8 +66,6 @@ R"===(
|
|||
"max-threads-hint": 100,
|
||||
"asm": true,
|
||||
"argon2-impl": null,
|
||||
"astrobwt-max-size": 550,
|
||||
"astrobwt-avx2": false,
|
||||
"cn/0": false,
|
||||
"cn-lite/0": false
|
||||
},
|
||||
|
|
|
@ -71,6 +71,7 @@ static const option options[] = {
|
|||
{ "hugepage-size", 1, nullptr, IConfig::HugePageSizeKey },
|
||||
{ "huge-pages-jit", 0, nullptr, IConfig::HugePagesJitKey },
|
||||
{ "hugepages-jit", 0, nullptr, IConfig::HugePagesJitKey },
|
||||
{ "rotation", 1, nullptr, IConfig::RotationKey },
|
||||
{ "pass", 1, nullptr, IConfig::PasswordKey },
|
||||
{ "print-time", 1, nullptr, IConfig::PrintTimeKey },
|
||||
{ "retries", 1, nullptr, IConfig::RetriesKey },
|
||||
|
@ -139,10 +140,6 @@ static const option options[] = {
|
|||
{ "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 },
|
||||
{ "astrobwt-avx2", 0, nullptr, IConfig::AstroBWTAVX2Key },
|
||||
#endif
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
{ "opencl", 0, nullptr, IConfig::OclKey },
|
||||
{ "opencl-devices", 1, nullptr, IConfig::OclDevicesKey },
|
||||
|
|
|
@ -105,11 +105,6 @@ static const std::string &usage()
|
|||
u += " --randomx-cache-qos enable Cache QoS\n";
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_ASTROBWT
|
||||
u += " --astrobwt-max-size=N skip hashes with large stage 2 size, default: 550, min: 400, max: 1200\n";
|
||||
u += " --astrobwt-avx2 enable AVX2 optimizations for AstroBWT algorithm";
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
u += "\nOpenCL backend:\n";
|
||||
u += " --opencl enable OpenCL mining backend\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue