From 4c3425a958eac4321a10778c153a125cc6e3ea03 Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 1 Feb 2021 05:06:24 +0700 Subject: [PATCH] Added "--hugepage-size" command line option. --- src/base/kernel/interfaces/IConfig.h | 1 + src/core/config/ConfigTransform.cpp | 10 +++++++--- src/core/config/Config_platform.h | 2 ++ src/core/config/usage.h | 5 ++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index 792c43a1..ba022fa3 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -85,6 +85,7 @@ public: BenchHashKey = 1047, BenchTokenKey = 1048, DmiKey = 1049, + HugePageSizeKey = 1050, // xmrig common CPUPriorityKey = 1021, diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp index 10f819e4..7140837a 100644 --- a/src/core/config/ConfigTransform.cpp +++ b/src/core/config/ConfigTransform.cpp @@ -125,9 +125,10 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const BaseTransform::transform(doc, key, arg); switch (key) { - case IConfig::AVKey: /* --av */ - case IConfig::CPUPriorityKey: /* --cpu-priority */ - case IConfig::ThreadsKey: /* --threads */ + case IConfig::AVKey: /* --av */ + case IConfig::CPUPriorityKey: /* --cpu-priority */ + case IConfig::ThreadsKey: /* --threads */ + case IConfig::HugePageSizeKey: /* --hugepage-size */ return transformUint64(doc, key, static_cast(strtol(arg, nullptr, 10))); case IConfig::HugePagesKey: /* --no-huge-pages */ @@ -306,6 +307,9 @@ void xmrig::ConfigTransform::transformUint64(rapidjson::Document &doc, int key, case IConfig::CPUPriorityKey: /* --cpu-priority */ return set(doc, CpuConfig::kField, CpuConfig::kPriority, arg); + case IConfig::HugePageSizeKey: /* --hugepage-size */ + return set(doc, CpuConfig::kField, CpuConfig::kHugePages, arg); + default: break; } diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index b6fcd1c1..28b1e2bd 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -71,6 +71,8 @@ static const option options[] = { { "nicehash", 0, nullptr, IConfig::NicehashKey }, { "no-color", 0, nullptr, IConfig::ColorKey }, { "no-huge-pages", 0, nullptr, IConfig::HugePagesKey }, + { "no-hugepages", 0, nullptr, IConfig::HugePagesKey }, + { "hugepage-size", 1, nullptr, IConfig::HugePageSizeKey }, { "pass", 1, nullptr, IConfig::PasswordKey }, { "print-time", 1, nullptr, IConfig::PrintTimeKey }, { "retries", 1, nullptr, IConfig::RetriesKey }, diff --git a/src/core/config/usage.h b/src/core/config/usage.h index 261e571c..a30ea133 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -83,6 +83,9 @@ static inline const std::string &usage() u += " --cpu-memory-pool=N number of 2 MB pages for persistent memory pool, -1 (auto), 0 (disable)\n"; u += " --cpu-no-yield prefer maximum hashrate rather than system response/stability\n"; u += " --no-huge-pages disable huge pages support\n"; +# ifdef XMRIG_OS_LINUX + u += " --hugepage-size=N custom hugepage size in kB\n"; +# endif u += " --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer\n"; # if defined(__x86_64__) || defined(_M_AMD64) @@ -155,7 +158,7 @@ static inline const std::string &usage() u += " -l, --log-file=FILE log all output to a file\n"; u += " --print-time=N print hashrate report every N seconds\n"; -# ifdef XMRIG_FEATURE_NVML +# if defined(XMRIG_FEATURE_NVML) || defined(XMRIG_FEATURE_ADL) u += " --health-print-time=N print health report every N seconds\n"; # endif u += " --no-color disable colored output\n";