Added draft support for multi backend benchmark

This commit is contained in:
MoneroOcean 2019-11-02 20:31:27 -07:00
parent c208f8eb8f
commit f131c2e5fb
3 changed files with 44 additions and 16 deletions

View file

@ -17,6 +17,7 @@
#pragma once
#include <set>
#include "net/interfaces/IJobResultListener.h"
#include "crypto/common/Algorithm.h"
#include "rapidjson/fwd.h"
@ -62,16 +63,20 @@ class Benchmark : public IJobResultListener {
float m_bench_algo_perf[BenchAlgo::MAX];
Controller* m_controller; // to get access to config and network
bool m_isNewBenchRun;
bool m_isNewBenchRun; // true if benchmark is need to be executed or was executed
Benchmark::BenchAlgo m_bench_algo; // current perf algo we benchmark
uint64_t m_hash_count; // number of hashes calculated for current perf algo
uint64_t m_time_start; // time of measurements start for current perf algo (in ms)
uint64_t m_time_start; // time of the first resultt for current perf algo (in ms)
uint64_t m_bench_start; // time of measurements start for current perf algo (in ms) after all backends are started
unsigned m_enabled_backend_count; // number of active miner backends
std::set<uint32_t> m_backends_started; // id of backend started for benchmark
uint64_t get_now() const; // get current time in ms
float get_algo_perf(Algorithm::Id algo) const; // get algo perf based on m_bench_algo_perf
void start(const Benchmark::BenchAlgo); // start benchmark for specified perf algo
void finish(); // end of benchmarks, switch to jobs from the pool (network), fill algo_perf
void onJobResult(const JobResult&) override; // onJobResult is called after each computed benchmark hash
void run_next_bench_algo(BenchAlgo); // run next bench algo or finish benchmark for the last one
public:
Benchmark();