Implemented static benchmark verification (--bench --seed --hash)
This commit is contained in:
parent
027a6f8ae2
commit
36c1cb23e0
14 changed files with 220 additions and 107 deletions
|
@ -138,10 +138,7 @@ private:
|
|||
class CpuBackendPrivate
|
||||
{
|
||||
public:
|
||||
inline CpuBackendPrivate(Controller *controller) :
|
||||
controller(controller)
|
||||
{
|
||||
}
|
||||
inline CpuBackendPrivate(Controller *controller) : controller(controller) {}
|
||||
|
||||
|
||||
inline void start()
|
||||
|
@ -155,7 +152,12 @@ public:
|
|||
);
|
||||
|
||||
status.start(threads, algo.l3());
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
workers.start(threads, benchmark);
|
||||
# else
|
||||
workers.start(threads);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,6 +206,10 @@ public:
|
|||
std::vector<CpuLaunchData> threads;
|
||||
String profileName;
|
||||
Workers<CpuLaunchData> workers;
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
std::shared_ptr<Benchmark> benchmark;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -338,7 +344,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
return stop();
|
||||
}
|
||||
|
||||
const CpuConfig &cpu = d_ptr->controller->config()->cpu();
|
||||
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());
|
||||
if (!d_ptr->threads.empty() && d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
|
||||
|
@ -356,6 +362,12 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
|
||||
stop();
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (job.benchSize()) {
|
||||
d_ptr->benchmark = std::make_shared<Benchmark>(job, threads.size(), this);
|
||||
}
|
||||
# endif
|
||||
|
||||
d_ptr->threads = std::move(threads);
|
||||
d_ptr->start();
|
||||
}
|
||||
|
@ -469,15 +481,14 @@ void xmrig::CpuBackend::handleRequest(IApiRequest &request)
|
|||
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||
xmrig::Benchmark *xmrig::CpuBackend::benchmark() const
|
||||
{
|
||||
return d_ptr->workers.benchmark();
|
||||
return d_ptr->benchmark.get();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuBackend::printBenchProgress() const
|
||||
{
|
||||
auto benchmark = d_ptr->workers.benchmark();
|
||||
if (benchmark) {
|
||||
benchmark->printProgress();
|
||||
if (d_ptr->benchmark) {
|
||||
d_ptr->benchmark->printProgress();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue