Implemented BenchClient.
This commit is contained in:
parent
36c1cb23e0
commit
79c96418c7
9 changed files with 200 additions and 18 deletions
|
@ -44,6 +44,7 @@ xmrig::Benchmark::Benchmark(const Job &job, size_t workers, const IBackend *back
|
|||
m_algo(job.algorithm()),
|
||||
m_backend(backend),
|
||||
m_workers(workers),
|
||||
m_id(job.id()),
|
||||
m_token(job.benchToken()),
|
||||
m_end(job.benchSize()),
|
||||
m_hash(job.benchHash())
|
||||
|
@ -116,6 +117,10 @@ uint64_t xmrig::Benchmark::referenceHash() const
|
|||
return m_hash;
|
||||
}
|
||||
|
||||
if (!m_token.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint32_t N = (m_end / 1000000) - 1;
|
||||
if (((m_algo == Algorithm::RX_0) || (m_algo == Algorithm::RX_WOW)) && ((m_end % 1000000) == 0) && (N < 10)) {
|
||||
return hashCheck[(m_algo == Algorithm::RX_0) ? 0 : 1][N];
|
||||
|
|
|
@ -53,6 +53,7 @@ private:
|
|||
const Algorithm m_algo;
|
||||
const IBackend *m_backend;
|
||||
const size_t m_workers;
|
||||
const String m_id;
|
||||
const String m_token;
|
||||
const uint64_t m_end;
|
||||
const uint64_t m_hash;
|
||||
|
|
|
@ -346,7 +346,13 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
|
||||
const auto &cpu = d_ptr->controller->config()->cpu();
|
||||
|
||||
std::vector<CpuLaunchData> threads = cpu.get(d_ptr->controller->miner(), job.algorithm(), d_ptr->controller->config()->pools().benchSize());
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
uint32_t benchSize = job.benchSize();
|
||||
# else
|
||||
constexpr uint32_t benchSize = 0;
|
||||
# endif
|
||||
|
||||
auto threads = cpu.get(d_ptr->controller->miner(), job.algorithm(), benchSize);
|
||||
if (!d_ptr->threads.empty() && d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
|
||||
return;
|
||||
}
|
||||
|
@ -363,7 +369,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
stop();
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (job.benchSize()) {
|
||||
if (benchSize) {
|
||||
d_ptr->benchmark = std::make_shared<Benchmark>(job, threads.size(), this);
|
||||
}
|
||||
# endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue