From 291e02adaff60b25c2fddbdb5d2fbfa79fa5d1a8 Mon Sep 17 00:00:00 2001 From: Haifa Bogdan Adnan Date: Mon, 2 Sep 2019 13:50:10 +0300 Subject: [PATCH] Fix for n/a hashrate in console. --- src/workers/Handle.cpp | 3 ++- src/workers/Handle.h | 5 +++-- src/workers/Workers.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/workers/Handle.cpp b/src/workers/Handle.cpp index cacaf636..14cf1b0d 100644 --- a/src/workers/Handle.cpp +++ b/src/workers/Handle.cpp @@ -26,7 +26,8 @@ #include "workers/Handle.h" -Handle::Handle(xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset) : +Handle::Handle(int id, xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset) : + m_id(id), m_offset(offset), m_config(config), m_hasherConfig(hasherConfig), diff --git a/src/workers/Handle.h b/src/workers/Handle.h index 50c7a2b4..f48f7e21 100644 --- a/src/workers/Handle.h +++ b/src/workers/Handle.h @@ -41,7 +41,7 @@ class IWorker; class Handle { public: - Handle(xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset); + Handle(int id, xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset); struct HandleArg { Handle *handle; @@ -52,7 +52,7 @@ public: void start(void (*callback) (void *)); inline std::vector &workers() { return m_workers; } - inline size_t hasherId() const { return m_hasherConfig->index(); } + inline size_t hasherId() const { return m_id; } inline size_t parallelism(int workerIdx) const { return m_hasher != nullptr ? m_hasher->parallelism(workerIdx) : 0; } inline size_t computingThreads() const { return m_hasher != nullptr ? m_hasher->computingThreads() : 0; } inline uint32_t offset() const { return m_offset; } @@ -61,6 +61,7 @@ public: inline Hasher *hasher() const { return m_hasher; } private: + int m_id; std::vector m_threads; std::vector m_workers; diff --git a/src/workers/Workers.cpp b/src/workers/Workers.cpp index d833a9f0..e4f9d250 100644 --- a/src/workers/Workers.cpp +++ b/src/workers/Workers.cpp @@ -167,7 +167,7 @@ bool Workers::start(xmrig::Controller *controller) uint32_t offset = 0; for (xmrig::HasherConfig *hasherConfig : hashers) { - Handle *handle = new Handle(controller->config(), hasherConfig, offset); + Handle *handle = new Handle((int)(m_workers.size()), controller->config(), hasherConfig, offset); if(handle->hasher() != nullptr) { offset += handle->computingThreads(); m_totalThreads += handle->computingThreads();