Use hwloc for set thread affinity.
This commit is contained in:
parent
9101469308
commit
72c9d94390
9 changed files with 118 additions and 38 deletions
|
@ -39,7 +39,7 @@
|
|||
#include <uv.h>
|
||||
|
||||
|
||||
#include "Platform.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef XMRIG_NVIDIA_PROJECT
|
||||
|
@ -52,7 +52,7 @@ typedef cpuset_t cpu_set_t;
|
|||
#endif
|
||||
|
||||
|
||||
char *Platform::createUserAgent()
|
||||
char *xmrig::Platform::createUserAgent()
|
||||
{
|
||||
constexpr const size_t max = 256;
|
||||
|
||||
|
@ -84,7 +84,8 @@ char *Platform::createUserAgent()
|
|||
}
|
||||
|
||||
|
||||
bool Platform::setThreadAffinity(uint64_t cpu_id)
|
||||
#ifndef XMRIG_FEATURE_HWLOC
|
||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||
{
|
||||
cpu_set_t mn;
|
||||
CPU_ZERO(&mn);
|
||||
|
@ -96,25 +97,26 @@ bool Platform::setThreadAffinity(uint64_t cpu_id)
|
|||
return sched_setaffinity(gettid(), sizeof(cpu_set_t), &mn) == 0;
|
||||
# endif
|
||||
}
|
||||
#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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue