mirror of
https://github.com/xmrig/xmrig.git
synced 2025-02-03 03:36:43 +00:00
Implemented "enabled" field for CPU backend;
This commit is contained in:
parent
d9164c0b7b
commit
fa2c9df075
3 changed files with 14 additions and 0 deletions
|
@ -44,6 +44,7 @@ class IBackend
|
|||
public:
|
||||
virtual ~IBackend() = default;
|
||||
|
||||
virtual bool isEnabled() const = 0;
|
||||
virtual bool isEnabled(const Algorithm &algorithm) const = 0;
|
||||
virtual const Hashrate *hashrate() const = 0;
|
||||
virtual const String &profileName() const = 0;
|
||||
|
|
|
@ -133,6 +133,12 @@ xmrig::CpuBackend::~CpuBackend()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::CpuBackend::isEnabled() const
|
||||
{
|
||||
return d_ptr->controller->config()->cpu().isEnabled();
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CpuBackend::isEnabled(const Algorithm &algorithm) const
|
||||
{
|
||||
return !d_ptr->controller->config()->cpu().threads().get(algorithm).empty();
|
||||
|
@ -178,6 +184,12 @@ void xmrig::CpuBackend::printHashrate(bool details)
|
|||
|
||||
void xmrig::CpuBackend::setJob(const Job &job)
|
||||
{
|
||||
if (!isEnabled()) {
|
||||
d_ptr->workers.stop();
|
||||
d_ptr->threads.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
const CpuConfig &cpu = d_ptr->controller->config()->cpu();
|
||||
|
||||
std::vector<CpuLaunchData> threads = cpu.get(d_ptr->controller->miner(), job.algorithm());
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
~CpuBackend() override;
|
||||
|
||||
protected:
|
||||
bool isEnabled() const override;
|
||||
bool isEnabled(const Algorithm &algorithm) const override;
|
||||
const Hashrate *hashrate() const override;
|
||||
const String &profileName() const override;
|
||||
|
|
Loading…
Reference in a new issue