mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
More cleanup.
This commit is contained in:
parent
6d8cf91568
commit
d1aadc2e3b
7 changed files with 37 additions and 12 deletions
|
@ -234,7 +234,7 @@ public:
|
|||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
bool initRX(IRxListener *listener)
|
||||
{
|
||||
return Rx::init(job, controller->config()->rx().threads(), controller->config()->cpu().isHugePages(), controller->config()->rx().isNUMA(), listener);
|
||||
return Rx::init(job, controller->config()->rx(), controller->config()->cpu().isHugePages(), listener);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "base/api/interfaces/IApiListener.h"
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/kernel/interfaces/ITimerListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
|
||||
|
||||
|
@ -48,6 +49,8 @@ class IBackend;
|
|||
class Miner : public ITimerListener, public IBaseListener, public IApiListener, public IRxListener
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Miner)
|
||||
|
||||
Miner(Controller *controller);
|
||||
~Miner() override;
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <uv.h>
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
|
||||
|
||||
#include "backend/cpu/Cpu.h"
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
xmrig::Config::Config() : BaseConfig(),
|
||||
xmrig::Config::Config() :
|
||||
d_ptr(new ConfigPrivate())
|
||||
{
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "base/tools/Object.h"
|
||||
#include "crypto/rx/RxAlgo.h"
|
||||
#include "crypto/rx/RxCache.h"
|
||||
#include "crypto/rx/RxConfig.h"
|
||||
#include "crypto/rx/RxDataset.h"
|
||||
#include "crypto/rx/RxSeed.h"
|
||||
|
||||
|
@ -222,7 +223,7 @@ public:
|
|||
}
|
||||
|
||||
m_ready = 0;
|
||||
m_numa = numa && Cpu::info()->nodes() > 1;
|
||||
m_numa = numa;
|
||||
m_hugePages = hugePages;
|
||||
m_listener = listener;
|
||||
m_seed = job;
|
||||
|
@ -256,7 +257,7 @@ private:
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
bool xmrig::Rx::init(const Job &job, int initThreads, bool hugePages, bool numa, IRxListener *listener)
|
||||
bool xmrig::Rx::init(const Job &job, const RxConfig &config, bool hugePages, IRxListener *listener)
|
||||
{
|
||||
if (job.algorithm().family() != Algorithm::RANDOM_X) {
|
||||
return true;
|
||||
|
@ -268,8 +269,8 @@ bool xmrig::Rx::init(const Job &job, int initThreads, bool hugePages, bool numa,
|
|||
return true;
|
||||
}
|
||||
|
||||
d_ptr->setState(job, hugePages, numa, listener);
|
||||
const uint32_t threads = initThreads < 1 ? static_cast<uint32_t>(Cpu::info()->threads()) : static_cast<uint32_t>(initThreads);
|
||||
d_ptr->setState(job, hugePages, config.isNUMA(), listener);
|
||||
const uint32_t threads = config.threads();
|
||||
const String buf = Buffer::toHex(job.seed().data(), 8);
|
||||
const uint64_t counter = d_ptr->counter();
|
||||
|
||||
|
|
|
@ -39,13 +39,14 @@ namespace xmrig
|
|||
class Algorithm;
|
||||
class IRxListener;
|
||||
class Job;
|
||||
class RxConfig;
|
||||
class RxDataset;
|
||||
|
||||
|
||||
class Rx
|
||||
{
|
||||
public:
|
||||
static bool init(const Job &job, int initThreads, bool hugePages, bool numa, IRxListener *listener);
|
||||
static bool init(const Job &job, const RxConfig &config, bool hugePages, IRxListener *listener);
|
||||
static bool isReady(const Job &job);
|
||||
static RxDataset *dataset(const Job &job, uint32_t nodeId);
|
||||
static std::pair<unsigned, unsigned> hugePages();
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "base/io/json/Json.h"
|
||||
#include "crypto/rx/RxConfig.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
|
@ -61,3 +62,17 @@ bool xmrig::RxConfig::read(const rapidjson::Value &value)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_HWLOC
|
||||
bool xmrig::RxConfig::isNUMA() const
|
||||
{
|
||||
return m_numa && Cpu::info()->nodes() > 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
uint32_t xmrig::RxConfig::threads() const
|
||||
{
|
||||
return m_threads < 1 ? static_cast<uint32_t>(Cpu::info()->threads()) : static_cast<uint32_t>(m_threads);
|
||||
}
|
||||
|
|
|
@ -38,8 +38,13 @@ public:
|
|||
bool read(const rapidjson::Value &value);
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
|
||||
inline bool isNUMA() const { return m_numa; }
|
||||
inline int threads() const { return m_threads; }
|
||||
# ifdef XMRIG_FEATURE_HWLOC
|
||||
bool isNUMA() const;
|
||||
# else
|
||||
inline constexpr bool isNUMA() const { return false; }
|
||||
# endif
|
||||
|
||||
uint32_t threads() const;
|
||||
|
||||
private:
|
||||
bool m_numa = true;
|
||||
|
|
Loading…
Reference in a new issue