Merge xmrig v6.8.0 into master

This commit is contained in:
MoneroOcean 2021-01-26 16:30:10 +00:00
commit 0c1fda1ada
70 changed files with 2872 additions and 1050 deletions

View file

@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* 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-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 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
@ -31,6 +25,12 @@
#include "net/Network.h"
#ifdef XMRIG_FEATURE_API
# include "base/api/Api.h"
# include "hw/api/HwApi.h"
#endif
#include <cassert>
@ -42,8 +42,6 @@ xmrig::Controller::Controller(Process *process) :
xmrig::Controller::~Controller()
{
delete m_network;
VirtualMemory::destroy();
}
@ -54,7 +52,12 @@ int xmrig::Controller::init()
VirtualMemory::init(config()->cpu().memPoolSize(), config()->cpu().isHugePages());
m_network = new Network(this);
m_network = std::make_shared<Network>(this);
# ifdef XMRIG_FEATURE_API
m_hwApi = std::make_shared<HwApi>();
api()->addListener(m_hwApi.get());
# endif
return 0;
}
@ -62,7 +65,7 @@ int xmrig::Controller::init()
#ifdef XMRIG_FEATURE_MO_BENCHMARK
void xmrig::Controller::pre_start()
{
m_miner = new Miner(this);
m_miner = std::make_shared<Miner>(this);
}
#endif
@ -70,9 +73,9 @@ void xmrig::Controller::pre_start()
void xmrig::Controller::start()
{
Base::start();
#ifndef XMRIG_FEATURE_BENCHMARK
m_miner = new Miner(this);
#endif
if (m_miner == nullptr) m_miner = std::make_shared<Miner>(this);
network()->connect();
}
@ -81,29 +84,26 @@ void xmrig::Controller::stop()
{
Base::stop();
delete m_network;
m_network = nullptr;
m_network.reset();
m_miner->stop();
delete m_miner;
m_miner = nullptr;
m_miner.reset();
}
xmrig::Miner *xmrig::Controller::miner() const
{
assert(m_miner != nullptr);
assert(m_miner);
return m_miner;
return m_miner.get();
}
xmrig::Network *xmrig::Controller::network() const
{
assert(m_network != nullptr);
assert(m_network);
return m_network;
return m_network.get();
}

View file

@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* 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-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 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
@ -27,12 +21,15 @@
#include "base/kernel/Base.h"
#include "base/tools/Object.h"
#include <memory>
namespace xmrig {
class HwApi;
class Job;
class Miner;
class Network;
@ -58,8 +55,12 @@ public:
void execCommand(char command);
private:
Miner *m_miner = nullptr;
Network *m_network = nullptr;
std::shared_ptr<Miner> m_miner;
std::shared_ptr<Network> m_network;
# ifdef XMRIG_FEATURE_API
std::shared_ptr<HwApi> m_hwApi;
# endif
};

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-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 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
@ -23,9 +23,9 @@
*/
#include <algorithm>
#include <cinttypes>
#include <cstring>
#include <uv.h>
#include <cinttypes>
#include "core/config/Config.h"
@ -55,16 +55,19 @@ namespace xmrig {
#ifdef XMRIG_FEATURE_OPENCL
static const char *kOcl = "opencl";
const char *Config::kOcl = "opencl";
#endif
#ifdef XMRIG_FEATURE_CUDA
static const char *kCuda = "cuda";
const char *Config::kCuda = "cuda";
#endif
#if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
static const char *kHealthPrintTime = "health-print-time";
const char *Config::kHealthPrintTime = "health-print-time";
#endif
#ifdef XMRIG_FEATURE_DMI
const char *Config::kDMI = "dmi";
#endif
@ -88,6 +91,10 @@ public:
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
uint32_t healthPrintTime = 60;
# endif
# ifdef XMRIG_FEATURE_DMI
bool dmi = true;
# endif
};
}
@ -143,6 +150,14 @@ uint32_t xmrig::Config::healthPrintTime() const
#endif
#ifdef XMRIG_FEATURE_DMI
bool xmrig::Config::isDMI() const
{
return d_ptr->dmi;
}
#endif
bool xmrig::Config::isShouldSave() const
{
if (!isAutoSave()) {
@ -201,6 +216,10 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
m_benchmark.read(reader.getValue(kAlgoPerf));
# endif
# ifdef XMRIG_FEATURE_DMI
d_ptr->dmi = reader.getBool(kDMI, d_ptr->dmi);
# endif
return true;
}
@ -246,6 +265,11 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
doc.AddMember(StringRef(kHealthPrintTime), healthPrintTime(), allocator);
# endif
# ifdef XMRIG_FEATURE_DMI
doc.AddMember(StringRef(kDMI), isDMI(), allocator);
# endif
doc.AddMember(StringRef(kSyslog), isSyslog(), allocator);
# ifdef XMRIG_FEATURE_TLS

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-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 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
@ -53,6 +53,22 @@ class Config : public BaseConfig
public:
XMRIG_DISABLE_COPY_MOVE(Config);
# ifdef XMRIG_FEATURE_OPENCL
static const char *kOcl;
# endif
# ifdef XMRIG_FEATURE_CUDA
static const char *kCuda;
# endif
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
static const char *kHealthPrintTime;
# endif
# ifdef XMRIG_FEATURE_DMI
static const char *kDMI;
# endif
Config();
~Config() override;
@ -73,7 +89,13 @@ public:
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
uint32_t healthPrintTime() const;
# else
uint32_t healthPrintTime() const { return 0; }
uint32_t healthPrintTime() const { return 0; }
# endif
# ifdef XMRIG_FEATURE_DMI
bool isDMI() const;
# else
static constexpr inline bool isDMI() { return false; }
# endif
bool isShouldSave() const;

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-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 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
@ -23,11 +23,11 @@
*/
#include "core/config/ConfigTransform.h"
#include "base/kernel/interfaces/IConfig.h"
#include "backend/cpu/CpuConfig.h"
#include "base/net/stratum/Pool.h"
#include "base/net/stratum/Pools.h"
#include "core/config/ConfigTransform.h"
#include "core/config/Config.h"
#include "crypto/cn/CnHash.h"
@ -51,14 +51,6 @@ static const char *kEnabled = "enabled";
static const char *kIntensity = "intensity";
static const char *kThreads = "threads";
#ifdef XMRIG_FEATURE_OPENCL
static const char *kOcl = "opencl";
#endif
#ifdef XMRIG_FEATURE_CUDA
static const char *kCuda = "cuda";
#endif
static inline uint64_t intensity(uint64_t av)
{
@ -122,7 +114,7 @@ void xmrig::ConfigTransform::finalize(rapidjson::Document &doc)
# ifdef XMRIG_FEATURE_OPENCL
if (m_opencl) {
set(doc, kOcl, kEnabled, true);
set(doc, Config::kOcl, kEnabled, true);
}
# endif
}
@ -208,47 +200,54 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
break;
case IConfig::OclCacheKey: /* --opencl-no-cache */
return set(doc, kOcl, "cache", false);
return set(doc, Config::kOcl, "cache", false);
case IConfig::OclLoaderKey: /* --opencl-loader */
return set(doc, kOcl, "loader", arg);
return set(doc, Config::kOcl, "loader", arg);
case IConfig::OclDevicesKey: /* --opencl-devices */
m_opencl = true;
return set(doc, kOcl, "devices-hint", arg);
return set(doc, Config::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, Config::kOcl, "platform", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
}
return set(doc, kOcl, "platform", arg);
return set(doc, Config::kOcl, "platform", arg);
# endif
# ifdef XMRIG_FEATURE_CUDA
case IConfig::CudaKey: /* --cuda */
return set(doc, kCuda, kEnabled, true);
return set(doc, Config::kCuda, kEnabled, true);
case IConfig::CudaLoaderKey: /* --cuda-loader */
return set(doc, kCuda, "loader", arg);
return set(doc, Config::kCuda, "loader", arg);
case IConfig::CudaDevicesKey: /* --cuda-devices */
set(doc, kCuda, kEnabled, true);
return set(doc, kCuda, "devices-hint", arg);
set(doc, Config::kCuda, kEnabled, true);
return set(doc, Config::kCuda, "devices-hint", arg);
case IConfig::CudaBFactorKey: /* --cuda-bfactor-hint */
return set(doc, kCuda, "bfactor-hint", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
return set(doc, Config::kCuda, "bfactor-hint", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
case IConfig::CudaBSleepKey: /* --cuda-bsleep-hint */
return set(doc, kCuda, "bsleep-hint", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
return set(doc, Config::kCuda, "bsleep-hint", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
# endif
# ifdef XMRIG_FEATURE_NVML
case IConfig::NvmlKey: /* --no-nvml */
return set(doc, kCuda, "nvml", false);
return set(doc, Config::kCuda, "nvml", false);
# endif
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
case IConfig::HealthPrintTimeKey: /* --health-print-time */
return set(doc, "health-print-time", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
return set(doc, Config::kHealthPrintTime, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
# endif
# ifdef XMRIG_FEATURE_DMI
case IConfig::DmiKey: /* --no-dmi */
return set(doc, Config::kDMI, false);
# endif
# ifdef XMRIG_FEATURE_BENCHMARK

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-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 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

@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* 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 (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 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
@ -22,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_CONFIG_DEFAULT_H
#define XMRIG_CONFIG_DEFAULT_H
@ -29,6 +24,7 @@
namespace xmrig {
// This feature require CMake option: -DWITH_EMBEDDED_CONFIG=ON
#ifdef XMRIG_FEATURE_EMBEDDED_CONFIG
const static char *default_config =
R"===(
@ -45,9 +41,9 @@ R"===(
"restricted": true
},
"autosave": true,
"version": 1,
"background": false,
"colors": true,
"title": true,
"randomx": {
"init": -1,
"init-avx2": -1,
@ -80,6 +76,7 @@ R"===(
"cache": true,
"loader": null,
"platform": "AMD",
"adl": true,
"cn/0": false,
"cn-lite/0": false
},
@ -90,7 +87,7 @@ R"===(
"cn/0": false,
"cn-lite/0": false
},
"donate-level": 5,
"donate-level": 1,
"donate-over-proxy": 1,
"log-file": null,
"pools": [
@ -107,15 +104,27 @@ R"===(
"tls": false,
"tls-fingerprint": null,
"daemon": false,
"socks5": null,
"self-select": null
}
],
"print-time": 60,
"health-print-time": 60,
"dmi": true,
"retries": 5,
"retry-pause": 5,
"syslog": false,
"tls": {
"enabled": false,
"protocols": null,
"cert": null,
"cert_key": null,
"ciphers": null,
"ciphersuites": null,
"dhparam": null
},
"user-agent": null,
"verbose": 0,
"watch": true,
"pause-on-battery": false
}

View file

@ -159,7 +159,12 @@ static const option options[] = {
# endif
# ifdef XMRIG_FEATURE_NVML
{ "no-nvml", 0, nullptr, IConfig::NvmlKey },
# endif
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
{ "health-print-time", 1, nullptr, IConfig::HealthPrintTimeKey },
# endif
# ifdef XMRIG_FEATURE_DMI
{ "no-dmi", 0, nullptr, IConfig::DmiKey },
# endif
{ nullptr, 0, nullptr, 0 }
};

View file

@ -190,6 +190,10 @@ static inline const std::string &usage()
u += " --hash=HASH compare benchmark result with specified hash\n";
# endif
# ifdef XMRIG_FEATURE_DMI
u += " --no-dmi disable DMI/SMBIOS reader\n";
# endif
return u;
}