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

@ -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;
}