Moved benchmark config save flag to the benchmark class
This commit is contained in:
parent
67ed81f1ec
commit
feeb226507
5 changed files with 10 additions and 11 deletions
|
@ -139,7 +139,9 @@ int App::exec()
|
||||||
: " >>>>> STARTING ALGO PERFORMANCE CALIBRATION (with %i seconds round)",
|
: " >>>>> STARTING ALGO PERFORMANCE CALIBRATION (with %i seconds round)",
|
||||||
m_controller->config()->calibrateAlgoTime()
|
m_controller->config()->calibrateAlgoTime()
|
||||||
);
|
);
|
||||||
benchmark.start_perf_bench(xmrig::PerfAlgo::PA_CN); // start benchmarking from first PerfAlgo in the list
|
// start benchmarking from first PerfAlgo in the list
|
||||||
|
if (m_controller->config()->get_algo_perf(xmrig::PA_CN) == 0.0f) benchmark.shoud_save_config();
|
||||||
|
benchmark.start_perf_bench(xmrig::PerfAlgo::PA_CN);
|
||||||
} else {
|
} else {
|
||||||
m_controller->network()->connect();
|
m_controller->network()->connect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ static char affinity_tmp[20] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
xmrig::Config::Config() : xmrig::CommonConfig(),
|
xmrig::Config::Config() : xmrig::CommonConfig(),
|
||||||
m_shouldSave(false),
|
|
||||||
m_aesMode(AES_AUTO),
|
m_aesMode(AES_AUTO),
|
||||||
m_algoVariant(AV_AUTO),
|
m_algoVariant(AV_AUTO),
|
||||||
m_hugePages(true),
|
m_hugePages(true),
|
||||||
|
@ -350,8 +349,6 @@ void xmrig::Config::parseJSON(const rapidjson::Document &doc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_algo_perf[xmrig::PA_CN] == 0.0f) m_shouldSave = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,6 @@ public:
|
||||||
|
|
||||||
void getJSON(rapidjson::Document &doc) const override;
|
void getJSON(rapidjson::Document &doc) const override;
|
||||||
|
|
||||||
inline bool isShouldSave() const { return m_shouldSave; }
|
|
||||||
inline AesMode aesMode() const { return m_aesMode; }
|
inline AesMode aesMode() const { return m_aesMode; }
|
||||||
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
||||||
inline bool isHugePages() const { return m_hugePages; }
|
inline bool isHugePages() const { return m_hugePages; }
|
||||||
|
@ -132,7 +131,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool m_shouldSave;
|
|
||||||
AesMode m_aesMode;
|
AesMode m_aesMode;
|
||||||
AlgoVariant m_algoVariant;
|
AlgoVariant m_algoVariant;
|
||||||
bool m_hugePages;
|
bool m_hugePages;
|
||||||
|
|
|
@ -80,7 +80,7 @@ void Benchmark::onJobResult(const JobResult& result) {
|
||||||
start_perf_bench(next_pa);
|
start_perf_bench(next_pa);
|
||||||
} else { // end of benchmarks and switching to jobs from the pool (network)
|
} else { // end of benchmarks and switching to jobs from the pool (network)
|
||||||
m_pa = xmrig::PA_INVALID;
|
m_pa = xmrig::PA_INVALID;
|
||||||
if (m_controller->config()->isShouldSave()) m_controller->config()->save(); // save config with measured algo-perf
|
if (m_shouldSaveConfig) m_controller->config()->save(); // save config with measured algo-perf
|
||||||
Workers::pause(); // do not compute anything before job from the pool
|
Workers::pause(); // do not compute anything before job from the pool
|
||||||
m_controller->network()->connect();
|
m_controller->network()->connect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,10 @@
|
||||||
#include "core/Controller.h"
|
#include "core/Controller.h"
|
||||||
|
|
||||||
class Benchmark : public IJobResultListener {
|
class Benchmark : public IJobResultListener {
|
||||||
xmrig::PerfAlgo m_pa; // current perf algo we benchmark
|
bool m_shouldSaveConfig; // should save config after all benchmark rounds
|
||||||
uint64_t m_hash_count; // number of hashes calculated for current perf algo
|
xmrig::PerfAlgo m_pa; // current perf algo we benchmark
|
||||||
uint64_t m_time_start; // time of measurements start for current perf algo (in ms)
|
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)
|
||||||
xmrig::Controller* m_controller; // to get access to config and network
|
xmrig::Controller* m_controller; // to get access to config and network
|
||||||
|
|
||||||
uint64_t get_now() const; // get current time in ms
|
uint64_t get_now() const; // get current time in ms
|
||||||
|
@ -41,9 +42,10 @@ class Benchmark : public IJobResultListener {
|
||||||
void onJobResult(const JobResult&) override; // onJobResult is called after each computed benchmark hash
|
void onJobResult(const JobResult&) override; // onJobResult is called after each computed benchmark hash
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Benchmark() {}
|
Benchmark() : m_shouldSaveConfig(false) {}
|
||||||
virtual ~Benchmark() {}
|
virtual ~Benchmark() {}
|
||||||
|
|
||||||
void set_controller(xmrig::Controller* controller) { m_controller = controller; }
|
void set_controller(xmrig::Controller* controller) { m_controller = controller; }
|
||||||
|
void shoud_save_config() { m_shouldSaveConfig = true; }
|
||||||
void start_perf_bench(const xmrig::PerfAlgo); // start benchmark for specified perf algo
|
void start_perf_bench(const xmrig::PerfAlgo); // start benchmark for specified perf algo
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue