Replacement for PR #1087

This commit is contained in:
XMRig 2019-07-31 09:29:09 +07:00
parent 962f0cdd8e
commit c138161ee2
2 changed files with 21 additions and 1 deletions

View file

@ -32,6 +32,12 @@
#include <hwloc.h> #include <hwloc.h>
#if HWLOC_API_VERSION < 0x00010b00
# define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET
# define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE
#endif
#include "backend/cpu/platform/HwlocCpuInfo.h" #include "backend/cpu/platform/HwlocCpuInfo.h"
#include "base/io/log/Log.h" #include "base/io/log/Log.h"
@ -152,7 +158,17 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
# endif # endif
hwloc_obj_t root = hwloc_get_root_obj(m_topology); hwloc_obj_t root = hwloc_get_root_obj(m_topology);
snprintf(m_backend, sizeof m_backend, "hwloc/%s", hwloc_obj_get_info_by_name(root, "hwlocVersion"));
# if HWLOC_API_VERSION >= 0x00010b00
const char *version = hwloc_obj_get_info_by_name(root, "hwlocVersion");
if (version) {
snprintf(m_backend, sizeof m_backend, "hwloc/%s", version);
}
else
# endif
{
snprintf(m_backend, sizeof m_backend, "hwloc");
}
findCache(root, 2, 3, [this](hwloc_obj_t found) { this->m_cache[found->attr->cache.depth] += found->attr->cache.size; }); findCache(root, 2, 3, [this](hwloc_obj_t found) { this->m_cache[found->attr->cache.depth] += found->attr->cache.size; });

View file

@ -28,6 +28,10 @@
#ifdef XMRIG_FEATURE_HWLOC #ifdef XMRIG_FEATURE_HWLOC
# include <hwloc.h> # include <hwloc.h>
# include "backend/cpu/platform/HwlocCpuInfo.h" # include "backend/cpu/platform/HwlocCpuInfo.h"
#
# if HWLOC_API_VERSION < 0x00010b00
# define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE
# endif
#endif #endif