Use hwloc for set thread affinity.

This commit is contained in:
XMRig 2019-10-06 14:40:42 +07:00
parent 9101469308
commit 72c9d94390
9 changed files with 118 additions and 38 deletions

View file

@ -30,7 +30,7 @@
#include <uv.h>
#include "Platform.h"
#include "base/kernel/Platform.h"
#include "version.h"
#ifdef XMRIG_NVIDIA_PROJECT
@ -38,7 +38,7 @@
#endif
char *Platform::createUserAgent()
char *xmrig::Platform::createUserAgent()
{
constexpr const size_t max = 256;
@ -60,7 +60,8 @@ char *Platform::createUserAgent()
}
bool Platform::setThreadAffinity(uint64_t cpu_id)
#ifndef XMRIG_FEATURE_HWLOC
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{
thread_port_t mach_thread;
thread_affinity_policy_data_t policy = { static_cast<integer_t>(cpu_id) };
@ -68,25 +69,26 @@ bool Platform::setThreadAffinity(uint64_t cpu_id)
return thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1) == KERN_SUCCESS;
}
#endif
uint32_t Platform::setTimerResolution(uint32_t resolution)
uint32_t xmrig::Platform::setTimerResolution(uint32_t resolution)
{
return resolution;
}
void Platform::restoreTimerResolution()
void xmrig::Platform::restoreTimerResolution()
{
}
void Platform::setProcessPriority(int priority)
void xmrig::Platform::setProcessPriority(int priority)
{
}
void Platform::setThreadPriority(int priority)
void xmrig::Platform::setThreadPriority(int priority)
{
if (priority == -1) {
return;