Code cleanup

This commit is contained in:
XMRig
2021-01-25 22:00:42 +07:00
parent 1424b2975f
commit b9081e992b
3 changed files with 13 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <support@xmrig.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 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
@ -50,6 +50,11 @@ extern String cpu_name_arm();
xmrig::BasicCpuInfo::BasicCpuInfo() :
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
memcpy(m_brand, "ARMv8", 5);
# else

View File

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

View File

@ -1,5 +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))
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 ON)
else()
set(WITH_DMI OFF)
endif()
if (WITH_DMI)