New detailed hashrate report.

This commit is contained in:
XMRig 2018-06-01 02:33:21 +07:00
parent 009bd1a507
commit 5d6a622b18
2 changed files with 32 additions and 0 deletions

View file

@ -22,6 +22,7 @@
*/ */
#include <cmath> #include <cmath>
#include <inttypes.h>
#include <thread> #include <thread>
@ -55,6 +56,7 @@ uv_async_t Workers::m_async;
uv_mutex_t Workers::m_mutex; uv_mutex_t Workers::m_mutex;
uv_rwlock_t Workers::m_rwlock; uv_rwlock_t Workers::m_rwlock;
uv_timer_t Workers::m_timer; uv_timer_t Workers::m_timer;
xmrig::Controller *Workers::m_controller = nullptr;
Job Workers::job() Job Workers::job()
@ -89,6 +91,33 @@ size_t Workers::threads()
void Workers::printHashrate(bool detail) void Workers::printHashrate(bool detail)
{ {
assert(m_controller != nullptr);
if (!m_controller) {
return;
}
if (detail) {
const bool isColors = m_controller->config()->isColors();
char num1[8] = { 0 };
char num2[8] = { 0 };
char num3[8] = { 0 };
Log::i()->text("%s| THREAD | AFFINITY | 10s H/s | 60s H/s | 15m H/s |", isColors ? "\x1B[1;37m" : "");
size_t i = 0;
for (const xmrig::IThread *thread : m_controller->config()->threads()) {
Log::i()->text("| %6zu | %8" PRId64 " | %7s | %7s | %7s |",
thread->index(),
thread->affinity(),
Hashrate::format(m_hashrate->calc(thread->index(), Hashrate::ShortInterval), num1, sizeof num1),
Hashrate::format(m_hashrate->calc(thread->index(), Hashrate::MediumInterval), num2, sizeof num2),
Hashrate::format(m_hashrate->calc(thread->index(), Hashrate::LargeInterval), num3, sizeof num3)
);
i++;
}
}
m_hashrate->print(); m_hashrate->print();
} }
@ -131,6 +160,8 @@ void Workers::setJob(const Job &job, bool donate)
void Workers::start(xmrig::Controller *controller) void Workers::start(xmrig::Controller *controller)
{ {
m_controller = controller;
const std::vector<xmrig::IThread *> &threads = controller->config()->threads(); const std::vector<xmrig::IThread *> &threads = controller->config()->threads();
m_status.algo = controller->config()->algorithm().algo(); m_status.algo = controller->config()->algorithm().algo();
m_status.colors = controller->config()->isColors(); m_status.colors = controller->config()->isColors();

View file

@ -114,6 +114,7 @@ private:
static uv_mutex_t m_mutex; static uv_mutex_t m_mutex;
static uv_rwlock_t m_rwlock; static uv_rwlock_t m_rwlock;
static uv_timer_t m_timer; static uv_timer_t m_timer;
static xmrig::Controller *m_controller;
}; };