diff --git a/src/core/MoBenchmark.cpp b/src/core/MoBenchmark.cpp index f7af4be81d..b8da6d7c98 100644 --- a/src/core/MoBenchmark.cpp +++ b/src/core/MoBenchmark.cpp @@ -79,6 +79,14 @@ void MoBenchmark::flush_perf() { for (const Algorithm::Id algo : Algorithm::all()) algo_perf[algo] = 0.0f; } +bool MoBenchmark::compare_perf(Config *previousConfig) { + // returns equivalent of == comparison + for (const Algorithm::Id algo : Algorithm::all()) { + if (algo_perf[algo] != previousConfig->benchmark().algo_perf[algo]) return false; + } + return true; +} + void MoBenchmark::read(const rapidjson::Value &value) { flush_perf(); diff --git a/src/core/MoBenchmark.h b/src/core/MoBenchmark.h index cc53433cd5..2daae105f2 100644 --- a/src/core/MoBenchmark.h +++ b/src/core/MoBenchmark.h @@ -31,6 +31,7 @@ namespace xmrig { class Controller; class Miner; class Job; +class Config; class MoBenchmark : public IJobResultListener { @@ -95,6 +96,7 @@ class MoBenchmark : public IJobResultListener { void set_controller(std::shared_ptr controller) { m_controller = controller.get(); } void start_perf(); // start benchmarks + bool compare_perf(Config *previousConfig); void flush_perf(); bool isNewBenchRun() const { return m_isNewBenchRun; } diff --git a/src/net/Network.cpp b/src/net/Network.cpp index 5d4f9481c5..9164a29f2f 100644 --- a/src/net/Network.cpp +++ b/src/net/Network.cpp @@ -149,9 +149,27 @@ void xmrig::Network::onActive(IStrategy *strategy, IClient *client) void xmrig::Network::onConfigChanged(Config *config, Config *previousConfig) { - if (config->pools() == previousConfig->pools() || !config->pools().active()) { + if (!config->pools().active() || + (config->pools() == previousConfig->pools() +# ifdef XMRIG_FEATURE_MO_BENCHMARK + && config->algoMinTime() == previousConfig->algoMinTime() + && config->benchmark().compare_perf(previousConfig) +# endif + ) + ) { return; } + if (config->pools() != previousConfig->pools()) { + LOG_WARN("%s " YELLOW("-> pools changed, reconnecting"), Tags::config()); + } +# ifdef XMRIG_FEATURE_MO_BENCHMARK + if (config->algoMinTime() != previousConfig->algoMinTime()) { + LOG_WARN("%s " YELLOW("-> algo-min-time changed, reconnecting"), Tags::config()); + } + if (!config->benchmark().compare_perf(previousConfig)) { + LOG_WARN("%s " YELLOW("-> algo-perf changed, reconnecting"), Tags::config()); + } +# endif m_strategy->stop();