This commit is contained in:
MoneroOcean 2020-02-15 15:41:35 -08:00
commit e71c1b51bf
58 changed files with 10426 additions and 2437 deletions

View file

@ -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);
}

View file

@ -70,7 +70,7 @@ static const char *kCuda = "cuda";
#endif
#if defined(XMRIG_FEATURE_NVML)
#if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
static const char *kHealthPrintTime = "health-print-time";
#endif
@ -92,7 +92,7 @@ public:
CudaConfig cuda;
# endif
# if defined(XMRIG_FEATURE_NVML)
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
uint32_t healthPrintTime = 60;
# endif
};
@ -142,7 +142,7 @@ const xmrig::RxConfig &xmrig::Config::rx() const
#endif
#if defined(XMRIG_FEATURE_NVML)
#if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
uint32_t xmrig::Config::healthPrintTime() const
{
return d_ptr->healthPrintTime;
@ -195,7 +195,7 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
d_ptr->cuda.read(reader.getValue(kCuda));
# endif
# ifdef XMRIG_FEATURE_NVML
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
d_ptr->healthPrintTime = reader.getUint(kHealthPrintTime, d_ptr->healthPrintTime);
# endif
@ -240,7 +240,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember(StringRef(kLogFile), m_logFile.toJSON(), allocator);
doc.AddMember(StringRef(Pools::kPools), m_pools.toJSON(doc), allocator);
doc.AddMember(StringRef(kPrintTime), printTime(), allocator);
# if defined(XMRIG_FEATURE_NVML)
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
doc.AddMember(StringRef(kHealthPrintTime), healthPrintTime(), allocator);
# endif
doc.AddMember(StringRef(Pools::kRetries), m_pools.retries(), allocator);

View file

@ -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
@ -69,8 +69,10 @@ public:
const RxConfig &rx() const;
# endif
# if defined(XMRIG_FEATURE_NVML)
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
uint32_t healthPrintTime() const;
# else
uint32_t healthPrintTime() const { return 0; }
# endif
bool isShouldSave() const;