mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-08 08:23:34 -05:00
Use hwloc for set thread affinity.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user