Added --calibrate-algo-time command line switch support
This commit is contained in:
parent
30a4f53c8f
commit
0bc9d775c6
7 changed files with 17 additions and 5 deletions
|
@ -135,8 +135,9 @@ int App::exec()
|
||||||
Workers::setListener(&benchmark); // register benchmark as job reault listener to compute hashrates there
|
Workers::setListener(&benchmark); // register benchmark as job reault listener to compute hashrates there
|
||||||
// write text before first benchmark round
|
// write text before first benchmark round
|
||||||
Log::i()->text(m_controller->config()->isColors()
|
Log::i()->text(m_controller->config()->isColors()
|
||||||
? GREEN_BOLD(" >>>>> ") WHITE_BOLD("STARTING ALGO PERFORMANCE CALIBRATION")
|
? GREEN_BOLD(" >>>>> ") WHITE_BOLD("STARTING ALGO PERFORMANCE CALIBRATION (with %i seconds round)")
|
||||||
: " >>>>> STARTING ALGO PERFORMANCE CALIBRATION"
|
: " >>>>> STARTING ALGO PERFORMANCE CALIBRATION (with %i seconds round)",
|
||||||
|
m_controller->config()->calibrateAlgoTime()
|
||||||
);
|
);
|
||||||
benchmark.start_perf_bench(xmrig::PerfAlgo::PA_CN); // start benchmarking from first PerfAlgo in the list
|
benchmark.start_perf_bench(xmrig::PerfAlgo::PA_CN); // start benchmarking from first PerfAlgo in the list
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -47,6 +47,7 @@ xmrig::CommonConfig::CommonConfig() :
|
||||||
m_colors(true),
|
m_colors(true),
|
||||||
m_dryRun(false),
|
m_dryRun(false),
|
||||||
m_calibrateAlgo(false),
|
m_calibrateAlgo(false),
|
||||||
|
m_calibrateAlgoTime(60),
|
||||||
m_saveConfig(false),
|
m_saveConfig(false),
|
||||||
m_syslog(false),
|
m_syslog(false),
|
||||||
|
|
||||||
|
@ -357,6 +358,12 @@ bool xmrig::CommonConfig::parseInt(int key, int arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CalibrateAlgoTimeKey: /* --calibrate-algo-time */
|
||||||
|
if (arg >= 5 && arg <= 3600) {
|
||||||
|
m_calibrateAlgoTime = arg;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
inline bool isColors() const { return m_colors; }
|
inline bool isColors() const { return m_colors; }
|
||||||
inline bool isDryRun() const { return m_dryRun; }
|
inline bool isDryRun() const { return m_dryRun; }
|
||||||
inline bool isCalibrateAlgo() const { return m_calibrateAlgo; }
|
inline bool isCalibrateAlgo() const { return m_calibrateAlgo; }
|
||||||
|
inline int calibrateAlgoTime() const { return m_calibrateAlgoTime; }
|
||||||
inline bool isSaveConfig() const { return m_saveConfig; }
|
inline bool isSaveConfig() const { return m_saveConfig; }
|
||||||
inline bool isSyslog() const { return m_syslog; }
|
inline bool isSyslog() const { return m_syslog; }
|
||||||
inline const char *apiToken() const { return m_apiToken.data(); }
|
inline const char *apiToken() const { return m_apiToken.data(); }
|
||||||
|
@ -91,6 +92,7 @@ protected:
|
||||||
bool m_colors;
|
bool m_colors;
|
||||||
bool m_dryRun;
|
bool m_dryRun;
|
||||||
bool m_calibrateAlgo;
|
bool m_calibrateAlgo;
|
||||||
|
int m_calibrateAlgoTime;
|
||||||
bool m_saveConfig;
|
bool m_saveConfig;
|
||||||
bool m_syslog;
|
bool m_syslog;
|
||||||
bool m_watch;
|
bool m_watch;
|
||||||
|
|
|
@ -69,7 +69,8 @@ public:
|
||||||
NicehashKey = 1006,
|
NicehashKey = 1006,
|
||||||
PrintTimeKey = 1007,
|
PrintTimeKey = 1007,
|
||||||
CalibrateAlgoKey = 10001,
|
CalibrateAlgoKey = 10001,
|
||||||
SaveConfigKey = 10002,
|
CalibrateAlgoTimeKey = 10002,
|
||||||
|
SaveConfigKey = 10003,
|
||||||
|
|
||||||
// xmrig cpu
|
// xmrig cpu
|
||||||
AVKey = 'v',
|
AVKey = 'v',
|
||||||
|
|
|
@ -56,6 +56,7 @@ Options:\n\
|
||||||
#endif
|
#endif
|
||||||
"\
|
"\
|
||||||
--calibrate-algo run benchmarks before mining to measure hashrates of all supported algos\n\
|
--calibrate-algo run benchmarks before mining to measure hashrates of all supported algos\n\
|
||||||
|
--calibrate-algo-time=N time in seconds to run each algo benchmark round (default: 60)\n\
|
||||||
-o, --url=URL URL of mining server\n\
|
-o, --url=URL URL of mining server\n\
|
||||||
-O, --userpass=U:P username:password pair for mining server\n\
|
-O, --userpass=U:P username:password pair for mining server\n\
|
||||||
-u, --user=USERNAME username for mining server\n\
|
-u, --user=USERNAME username for mining server\n\
|
||||||
|
@ -114,6 +115,7 @@ static struct option const options[] = {
|
||||||
{ "donate-level", 1, nullptr, xmrig::IConfig::DonateLevelKey },
|
{ "donate-level", 1, nullptr, xmrig::IConfig::DonateLevelKey },
|
||||||
{ "dry-run", 0, nullptr, xmrig::IConfig::DryRunKey },
|
{ "dry-run", 0, nullptr, xmrig::IConfig::DryRunKey },
|
||||||
{ "calibrate-algo", 0, nullptr, xmrig::IConfig::CalibrateAlgoKey },
|
{ "calibrate-algo", 0, nullptr, xmrig::IConfig::CalibrateAlgoKey },
|
||||||
|
{ "calibrate-algo-time", 1, nullptr, xmrig::IConfig::CalibrateAlgoTimeKey },
|
||||||
{ "save-config", 0, nullptr, xmrig::IConfig::SaveConfigKey },
|
{ "save-config", 0, nullptr, xmrig::IConfig::SaveConfigKey },
|
||||||
{ "help", 0, nullptr, xmrig::IConfig::HelpKey },
|
{ "help", 0, nullptr, xmrig::IConfig::HelpKey },
|
||||||
{ "keepalive", 0, nullptr, xmrig::IConfig::KeepAliveKey },
|
{ "keepalive", 0, nullptr, xmrig::IConfig::KeepAliveKey },
|
||||||
|
|
|
@ -66,7 +66,7 @@ void Benchmark::onJobResult(const JobResult& result) {
|
||||||
++ m_hash_count;
|
++ m_hash_count;
|
||||||
const uint64_t now = get_now();
|
const uint64_t now = get_now();
|
||||||
if (!m_time_start) m_time_start = now; // time of measurements start (in ms)
|
if (!m_time_start) m_time_start = now; // time of measurements start (in ms)
|
||||||
else if (now - m_time_start > m_bench_secs*1000) { // end of becnhmark round for m_pa
|
else if (now - m_time_start > static_cast<unsigned>(m_controller->config()->calibrateAlgoTime())*1000) { // end of becnhmark round for m_pa
|
||||||
const float hashrate = static_cast<float>(m_hash_count) * result.diff / (now - m_time_start) * 1000.0f;
|
const float hashrate = static_cast<float>(m_hash_count) * result.diff / (now - m_time_start) * 1000.0f;
|
||||||
m_controller->config()->set_algo_perf(m_pa, hashrate); // store hashrate result
|
m_controller->config()->set_algo_perf(m_pa, hashrate); // store hashrate result
|
||||||
Log::i()->text(m_controller->config()->isColors()
|
Log::i()->text(m_controller->config()->isColors()
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "core/Controller.h"
|
#include "core/Controller.h"
|
||||||
|
|
||||||
class Benchmark : public IJobResultListener {
|
class Benchmark : public IJobResultListener {
|
||||||
const uint64_t m_bench_secs = 5; // time in seconds to benchmark each perf algo
|
|
||||||
xmrig::PerfAlgo m_pa; // current perf algo we benchmark
|
xmrig::PerfAlgo m_pa; // current perf algo we benchmark
|
||||||
uint64_t m_hash_count; // number of hashes calculated for current perf algo
|
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 measurements start for current perf algo (in ms)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue