1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-07 16:05:05 -05:00

#1385 "max-threads-hint" option now also limit RandomX dataset initialization threads.

This commit is contained in:
XMRig
2019-12-07 22:18:06 +07:00
parent 3a75f39935
commit e9e747f0d1
8 changed files with 21 additions and 14 deletions

View File

@@ -30,6 +30,7 @@
#include <array>
#include <algorithm>
#include <cmath>
#ifdef _MSC_VER
@@ -52,9 +53,17 @@ const char *xmrig::RxConfig::modeName() const
}
uint32_t xmrig::RxConfig::threads() const
uint32_t xmrig::RxConfig::threads(uint32_t limit) const
{
return m_threads < 1 ? static_cast<uint32_t>(Cpu::info()->threads()) : static_cast<uint32_t>(m_threads);
if (m_threads > 0) {
return m_threads;
}
if (limit < 100) {
return std::max(static_cast<uint32_t>(round(Cpu::info()->threads() * (limit / 100.0))), 1U);
}
return Cpu::info()->threads();
}