Code cleanup

This commit is contained in:
XMRig 2021-01-25 22:00:42 +07:00
parent 1424b2975f
commit b9081e992b
No known key found for this signature in database
GPG key ID: 446A53638BE94409
3 changed files with 13 additions and 10 deletions

View file

@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <support@xmrig.com> * Copyright (c) 2016-2021 XMRig <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -50,6 +50,11 @@ extern String cpu_name_arm();
xmrig::BasicCpuInfo::BasicCpuInfo() : xmrig::BasicCpuInfo::BasicCpuInfo() :
m_threads(std::thread::hardware_concurrency()) m_threads(std::thread::hardware_concurrency())
{ {
m_units.resize(m_threads);
for (int32_t i = 0; i < static_cast<int32_t>(m_threads); ++i) {
m_units[i] = i;
}
# ifdef XMRIG_ARMv8 # ifdef XMRIG_ARMv8
memcpy(m_brand, "ARMv8", 5); memcpy(m_brand, "ARMv8", 5);
# else # else

View file

@ -125,8 +125,6 @@ static inline bool isCacheExclusive(hwloc_obj_t obj)
xmrig::HwlocCpuInfo::HwlocCpuInfo() xmrig::HwlocCpuInfo::HwlocCpuInfo()
{ {
m_threads = 0;
hwloc_topology_init(&m_topology); hwloc_topology_init(&m_topology);
hwloc_topology_load(m_topology); hwloc_topology_load(m_topology);
@ -278,10 +276,8 @@ xmrig::CpuThreads xmrig::HwlocCpuInfo::allThreads(const Algorithm &algorithm, ui
CpuThreads threads; CpuThreads threads;
threads.reserve(m_threads); threads.reserve(m_threads);
hwloc_obj_t pu = nullptr; for (const int32_t pu : m_units) {
threads.add(pu, 0);
while ((pu = hwloc_get_next_obj_by_type(m_topology, HWLOC_OBJ_PU, pu)) != nullptr) {
threads.add(pu->os_index, 0);
} }
if (threads.isEmpty()) { if (threads.isEmpty()) {

View file

@ -1,5 +1,7 @@
if (WITH_DMI) if (WITH_DMI AND (XMRIG_OS_WIN OR XMRIG_OS_LINUX OR XMRIG_OS_FREEBSD OR (XMRIG_OS_MACOS AND NOT XMRIG_ARM)))
set(WITH_DMI XMRIG_OS_WIN OR XMRIG_OS_LINUX OR XMRIG_OS_FREEBSD OR (XMRIG_OS_MACOS AND NOT XMRIG_ARM)) set(WITH_DMI ON)
else()
set(WITH_DMI OFF)
endif() endif()
if (WITH_DMI) if (WITH_DMI)