mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-10 21:04:37 +00:00
Quick fix, temporary use old style affinity.
This commit is contained in:
parent
dd6bc339bf
commit
d4123b8fa6
4 changed files with 9 additions and 6 deletions
|
@ -25,7 +25,8 @@
|
|||
#include "workers/Handle.h"
|
||||
|
||||
|
||||
Handle::Handle(xmrig::IThread *config, size_t totalThreads, size_t totalWays) :
|
||||
Handle::Handle(xmrig::IThread *config, size_t totalThreads, size_t totalWays, int64_t affinity) :
|
||||
m_affinity(affinity),
|
||||
m_worker(nullptr),
|
||||
m_totalThreads(totalThreads),
|
||||
m_totalWays(totalWays),
|
||||
|
|
|
@ -38,10 +38,11 @@ class IWorker;
|
|||
class Handle
|
||||
{
|
||||
public:
|
||||
Handle(xmrig::IThread *config, size_t totalThreads, size_t totalWays);
|
||||
Handle(xmrig::IThread *config, size_t totalThreads, size_t totalWays, int64_t affinity);
|
||||
void join();
|
||||
void start(void (*callback) (void *));
|
||||
|
||||
inline int64_t affinity() const { return m_affinity; }
|
||||
inline IWorker *worker() const { return m_worker; }
|
||||
inline size_t threadId() const { return m_config->index(); }
|
||||
inline size_t totalThreads() const { return m_totalThreads; }
|
||||
|
@ -50,6 +51,7 @@ public:
|
|||
inline xmrig::IThread *config() const { return m_config; }
|
||||
|
||||
private:
|
||||
int64_t m_affinity;
|
||||
IWorker *m_worker;
|
||||
size_t m_totalThreads;
|
||||
size_t m_totalWays;
|
||||
|
|
|
@ -42,9 +42,9 @@ Worker::Worker(Handle *handle) :
|
|||
m_sequence(0),
|
||||
m_thread(static_cast<xmrig::CpuThread *>(handle->config()))
|
||||
{
|
||||
// if (Cpu::threads() > 1 && handle->affinity() != -1L) {
|
||||
// Cpu::setAffinity(m_id, handle->affinity());
|
||||
// }
|
||||
if (Cpu::threads() > 1 && handle->affinity() != -1L) {
|
||||
Cpu::setAffinity(m_id, handle->affinity());
|
||||
}
|
||||
|
||||
Platform::setThreadPriority(handle->config()->priority());
|
||||
m_ctx = Mem::create(m_id);
|
||||
|
|
|
@ -130,7 +130,7 @@ void Workers::start(xmrig::Controller *controller)
|
|||
uv_timer_start(&m_timer, Workers::onTick, 500, 500);
|
||||
|
||||
for (xmrig::IThread *thread : threads) {
|
||||
Handle *handle = new Handle(thread, threads.size(), totalWays);
|
||||
Handle *handle = new Handle(thread, threads.size(), totalWays, controller->config()->affinity());
|
||||
m_workers.push_back(handle);
|
||||
handle->start(Workers::onReady);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue