mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-22 19:49:36 +00:00
Added config option "dmi" and command line option "--no-dmi".
This commit is contained in:
parent
efc5e5d811
commit
9a02007900
11 changed files with 121 additions and 56 deletions
|
@ -26,7 +26,7 @@ option(WITH_PROFILING "Enable profiling for developers" OFF)
|
|||
option(WITH_SSE4_1 "Enable SSE 4.1 for Blake2" ON)
|
||||
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
|
||||
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
|
||||
option(WITH_DMI "Enable DMI reader" OFF)
|
||||
option(WITH_DMI "Enable DMI/SMBIOS reader" OFF)
|
||||
|
||||
option(BUILD_STATIC "Build static binary" OFF)
|
||||
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <support@xmrig.com>
|
||||
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2021 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
|
||||
|
@ -76,7 +76,7 @@ inline static const char *asmName(Assembly::Id assembly)
|
|||
#endif
|
||||
|
||||
|
||||
static void print_memory(Config *config)
|
||||
static void print_pages(const Config *config)
|
||||
{
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
"HUGE PAGES", config->cpu().isHugePages() ? (VirtualMemory::isHugepagesAvailable() ? kHugepagesSupported : RED_BOLD("unavailable")) : RED_BOLD("disabled"));
|
||||
|
@ -92,7 +92,7 @@ static void print_memory(Config *config)
|
|||
}
|
||||
|
||||
|
||||
static void print_cpu(Config *)
|
||||
static void print_cpu(const Config *)
|
||||
{
|
||||
const auto info = Cpu::info();
|
||||
|
||||
|
@ -121,7 +121,7 @@ static void print_cpu(Config *)
|
|||
}
|
||||
|
||||
|
||||
static void print_memory()
|
||||
static void print_memory(const Config *config)
|
||||
{
|
||||
constexpr size_t oneGiB = 1024U * 1024U * 1024U;
|
||||
const auto freeMem = static_cast<double>(uv_get_free_memory());
|
||||
|
@ -137,6 +137,10 @@ static void print_memory()
|
|||
);
|
||||
|
||||
# ifdef XMRIG_FEATURE_DMI
|
||||
if (!config->isDMI()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DmiReader reader;
|
||||
if (!reader.read()) {
|
||||
return;
|
||||
|
@ -167,7 +171,7 @@ static void print_memory()
|
|||
}
|
||||
|
||||
|
||||
static void print_threads(Config *config)
|
||||
static void print_threads(const Config *config)
|
||||
{
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s%d%%"),
|
||||
"DONATE",
|
||||
|
@ -209,14 +213,16 @@ static void print_commands(Config *)
|
|||
|
||||
void xmrig::Summary::print(Controller *controller)
|
||||
{
|
||||
controller->config()->printVersions();
|
||||
print_memory(controller->config());
|
||||
print_cpu(controller->config());
|
||||
print_memory();
|
||||
print_threads(controller->config());
|
||||
controller->config()->pools().print();
|
||||
const auto config = controller->config();
|
||||
|
||||
print_commands(controller->config());
|
||||
config->printVersions();
|
||||
print_pages(config);
|
||||
print_cpu(config);
|
||||
print_memory(config);
|
||||
print_threads(config);
|
||||
config->pools().print();
|
||||
|
||||
print_commands(config);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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-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
|
||||
|
|
|
@ -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
|
||||
|
@ -84,6 +84,7 @@ public:
|
|||
BenchSeedKey = 1046,
|
||||
BenchHashKey = 1047,
|
||||
BenchTokenKey = 1048,
|
||||
DmiKey = 1049,
|
||||
|
||||
// xmrig common
|
||||
CPUPriorityKey = 1021,
|
||||
|
|
|
@ -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()) {
|
||||
|
@ -191,6 +206,10 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
|
|||
d_ptr->healthPrintTime = reader.getUint(kHealthPrintTime, d_ptr->healthPrintTime);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_DMI
|
||||
d_ptr->dmi = reader.getBool(kDMI, d_ptr->dmi);
|
||||
# endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -236,6 +255,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
|
||||
|
|
|
@ -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
|
||||
|
@ -50,6 +50,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;
|
||||
|
||||
|
@ -70,7 +86,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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -155,7 +155,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 }
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
if (WITH_DMI)
|
||||
set(WITH_DMI XMRIG_OS_WIN OR XMRIG_OS_LINUX OR XMRIG_OS_FREEBSD OR (XMRIG_OS_MACOS AND NOT XMRIG_ARM))
|
||||
endif()
|
||||
|
||||
if (WITH_DMI)
|
||||
add_definitions(/DXMRIG_FEATURE_DMI)
|
||||
|
||||
|
|
Loading…
Reference in a new issue