mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 00:37:46 +00:00
Added printHealth to IBackend interface.
This commit is contained in:
parent
56f23db878
commit
2f27d5d108
8 changed files with 54 additions and 44 deletions
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -56,6 +56,7 @@ public:
|
|||
virtual void execCommand(char command) = 0;
|
||||
virtual void prepare(const Job &nextJob) = 0;
|
||||
virtual void printHashrate(bool details) = 0;
|
||||
virtual void printHealth() = 0;
|
||||
virtual void setJob(const Job &job) = 0;
|
||||
virtual void start(IWorker *worker, bool ready) = 0;
|
||||
virtual void stop() = 0;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -319,6 +319,11 @@ void xmrig::CpuBackend::printHashrate(bool details)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::CpuBackend::printHealth()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuBackend::setJob(const Job &job)
|
||||
{
|
||||
if (!isEnabled()) {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -59,6 +59,7 @@ protected:
|
|||
const String &type() const override;
|
||||
void prepare(const Job &nextJob) override;
|
||||
void printHashrate(bool details) override;
|
||||
void printHealth() override;
|
||||
void setJob(const Job &job) override;
|
||||
void start(IWorker *worker, bool ready) override;
|
||||
void stop() override;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -254,7 +254,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
LOG_INFO(CYAN_BOLD("#%u") YELLOW(" %s") MAGENTA_BOLD("%4uW") CSI "1;%um %2uC" CLEAR WHITE_BOLD("%s") "%s",
|
||||
LOG_INFO("%s" CYAN_BOLD(" #%u") YELLOW(" %s") MAGENTA_BOLD("%4uW") CSI "1;%um %2uC" CLEAR WHITE_BOLD("%s") "%s",
|
||||
tag,
|
||||
device.index(),
|
||||
device.topology().toString().data(),
|
||||
health.power,
|
||||
|
@ -338,13 +339,8 @@ const xmrig::String &xmrig::CudaBackend::type() const
|
|||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::execCommand(char command)
|
||||
void xmrig::CudaBackend::execCommand(char)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (command == 'e' || command == 'E') {
|
||||
d_ptr->printHealth();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -387,6 +383,14 @@ void xmrig::CudaBackend::printHashrate(bool details)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::printHealth()
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
d_ptr->printHealth();
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::setJob(const Job &job)
|
||||
{
|
||||
const auto &cuda = d_ptr->controller->config()->cuda();
|
||||
|
@ -455,15 +459,6 @@ void xmrig::CudaBackend::stop()
|
|||
void xmrig::CudaBackend::tick(uint64_t ticks)
|
||||
{
|
||||
d_ptr->workers.tick(ticks);
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (isEnabled()) {
|
||||
auto seconds = d_ptr->controller->config()->healthPrintTime();
|
||||
if (seconds && ticks && (ticks % (seconds * 2)) == 0) {
|
||||
d_ptr->printHealth();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -59,6 +59,7 @@ protected:
|
|||
void execCommand(char command) override;
|
||||
void prepare(const Job &nextJob) override;
|
||||
void printHashrate(bool details) override;
|
||||
void printHealth() override;
|
||||
void setJob(const Job &job) override;
|
||||
void start(IWorker *worker, bool ready) override;
|
||||
void stop() override;
|
||||
|
|
|
@ -324,13 +324,8 @@ const xmrig::String &xmrig::OclBackend::type() const
|
|||
}
|
||||
|
||||
|
||||
void xmrig::OclBackend::execCommand(char command)
|
||||
void xmrig::OclBackend::execCommand(char)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_ADL
|
||||
if (command == 'e' || command == 'E') {
|
||||
d_ptr->printHealth();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -373,6 +368,14 @@ void xmrig::OclBackend::printHashrate(bool details)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::OclBackend::printHealth()
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_ADL
|
||||
d_ptr->printHealth();
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclBackend::setJob(const Job &job)
|
||||
{
|
||||
const auto &cl = d_ptr->controller->config()->cl();
|
||||
|
@ -449,15 +452,6 @@ void xmrig::OclBackend::stop()
|
|||
void xmrig::OclBackend::tick(uint64_t ticks)
|
||||
{
|
||||
d_ptr->workers.tick(ticks);
|
||||
|
||||
# ifdef XMRIG_FEATURE_ADL
|
||||
if (isEnabled()) {
|
||||
auto seconds = d_ptr->controller->config()->healthPrintTime();
|
||||
if (seconds && ticks && (ticks % (seconds * 2)) == 0) {
|
||||
d_ptr->printHealth();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ protected:
|
|||
void execCommand(char command) override;
|
||||
void prepare(const Job &nextJob) override;
|
||||
void printHashrate(bool details) override;
|
||||
void printHealth() override;
|
||||
void setJob(const Job &job) override;
|
||||
void start(IWorker *worker, bool ready) override;
|
||||
void stop() override;
|
||||
|
|
|
@ -353,6 +353,13 @@ void xmrig::Miner::execCommand(char command)
|
|||
setEnabled(true);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
case 'E':
|
||||
for (auto backend : d_ptr->backends) {
|
||||
backend->printHealth();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -489,11 +496,16 @@ void xmrig::Miner::onConfigChanged(Config *config, Config *previousConfig)
|
|||
|
||||
void xmrig::Miner::onTimer(const Timer *)
|
||||
{
|
||||
double maxHashrate = 0.0;
|
||||
double maxHashrate = 0.0;
|
||||
const auto healthPrintTime = d_ptr->controller->config()->healthPrintTime();
|
||||
|
||||
for (IBackend *backend : d_ptr->backends) {
|
||||
backend->tick(d_ptr->ticks);
|
||||
|
||||
if (healthPrintTime && d_ptr->ticks && (d_ptr->ticks % (healthPrintTime * 2)) == 0 && backend->isEnabled()) {
|
||||
backend->printHealth();
|
||||
}
|
||||
|
||||
if (backend->hashrate()) {
|
||||
maxHashrate += backend->hashrate()->calc(Hashrate::ShortInterval);
|
||||
}
|
||||
|
@ -501,8 +513,8 @@ void xmrig::Miner::onTimer(const Timer *)
|
|||
|
||||
d_ptr->maxHashrate[d_ptr->algorithm] = std::max(d_ptr->maxHashrate[d_ptr->algorithm], maxHashrate);
|
||||
|
||||
auto seconds = d_ptr->controller->config()->printTime();
|
||||
if (seconds && (d_ptr->ticks % (seconds * 2)) == 0) {
|
||||
const auto printTime = d_ptr->controller->config()->printTime();
|
||||
if (printTime && d_ptr->ticks && (d_ptr->ticks % (printTime * 2)) == 0) {
|
||||
printHashrate(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue