From 1391a2d8582e91fb38bf3c5a09974f1734ea6ff4 Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 2 Nov 2017 19:40:33 +0300 Subject: [PATCH] #184 Workaround for CPUs with disabled Hyper-Threading. --- src/Cpu.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Cpu.cpp b/src/Cpu.cpp index 2e79b6dfd..ff6f49e95 100644 --- a/src/Cpu.cpp +++ b/src/Cpu.cpp @@ -86,9 +86,13 @@ void Cpu::initCommon() strncpy(m_brand, data.brand_str, sizeof(m_brand) - 1); m_totalThreads = data.total_logical_cpus; - m_sockets = m_totalThreads / data.num_logical_cpus; - m_totalCores = data.num_cores *m_sockets; + m_sockets = m_totalThreads / data.num_logical_cpus; + if (m_sockets == 0) { + m_sockets = 1; + } + + m_totalCores = data.num_cores * m_sockets; m_l3_cache = data.l3_cache > 0 ? data.l3_cache * m_sockets : 0; // Workaround for AMD CPUs https://github.com/anrieff/libcpuid/issues/97