Preparation for #1.4.0 (#30)

- Fixed CPU affinity on Windows for NUMA and CPUs with lot of cores
- Implemented per thread configurable Multihash mode (double, triple, quadruple, quintuple)
- Rebased from XMRig 2.4.4
This commit is contained in:
Ben Gräf 2018-01-19 19:42:06 +01:00 committed by GitHub
parent 990bf8d963
commit cf868666d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 2575 additions and 1104 deletions

View file

@ -30,11 +30,9 @@
#include "api/Api.h"
#include "interfaces/IJobResultListener.h"
#include "Mem.h"
#include "Options.h"
#include "workers/DoubleWorker.h"
#include "workers/MultiWorker.h"
#include "workers/Handle.h"
#include "workers/Hashrate.h"
#include "workers/SingleWorker.h"
#include "workers/Workers.h"
@ -118,7 +116,7 @@ void Workers::start(int64_t affinity, int priority)
uv_timer_start(&m_timer, Workers::onTick, 500, 500);
for (int i = 0; i < threads; ++i) {
Handle *handle = new Handle(i, threads, affinity, priority);
auto handle = new Handle(i, threads, affinity, priority);
m_workers.push_back(handle);
handle->start(Workers::onReady);
}
@ -134,8 +132,8 @@ void Workers::stop()
m_paused = 0;
m_sequence = 0;
for (size_t i = 0; i < m_workers.size(); ++i) {
m_workers[i]->join();
for (auto worker : m_workers) {
worker->join();
}
}
@ -153,13 +151,7 @@ void Workers::submit(const JobResult &result, int threadId)
void Workers::onReady(void *arg)
{
auto handle = static_cast<Handle*>(arg);
if (Mem::isDoubleHash(handle->threadId())) {
handle->setWorker(new DoubleWorker(handle));
}
else {
handle->setWorker(new SingleWorker(handle));
}
handle->setWorker(createMultiWorker(Mem::getThreadHashFactor(handle->threadId()), handle));
handle->worker()->start();
}
@ -185,12 +177,12 @@ void Workers::onResult(uv_async_t *handle)
void Workers::onTick(uv_timer_t *handle)
{
for (Handle *handle : m_workers) {
if (!handle->worker()) {
for (auto workerHandle : m_workers) {
if (!workerHandle->worker()) {
return;
}
m_hashrate->add(handle->threadId(), handle->worker()->hashCount(), handle->worker()->timestamp());
m_hashrate->add(workerHandle->threadId(), workerHandle->worker()->hashCount(), workerHandle->worker()->timestamp());
}
if ((m_ticks++ & 0xF) == 0) {