diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c7df32e..8a417fb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,7 +126,7 @@ set(SOURCES_CRYPTO if (WITH_BENCHMARK) list(APPEND SOURCES - src/core/Benchmark.cpp + src/core/MoBenchmark.cpp ) add_definitions(/DXMRIG_FEATURE_BENCHMARK) endif() diff --git a/src/core/Benchmark.cpp b/src/core/MoBenchmark.cpp similarity index 92% rename from src/core/Benchmark.cpp rename to src/core/MoBenchmark.cpp index 491e2ce6..464729bb 100644 --- a/src/core/Benchmark.cpp +++ b/src/core/MoBenchmark.cpp @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -#include "core/Benchmark.h" +#include "core/MoBenchmark.h" #include "3rdparty/rapidjson/document.h" #include "backend/common/Hashrate.h" #include "backend/common/interfaces/IBackend.h" @@ -34,20 +34,20 @@ namespace xmrig { -Benchmark::Benchmark() : m_controller(nullptr), m_isNewBenchRun(true) { +MoBenchmark::MoBenchmark() : m_controller(nullptr), m_isNewBenchRun(true) { for (BenchAlgo bench_algo = BenchAlgo::MIN; bench_algo != BenchAlgo::MAX; bench_algo = static_cast(bench_algo + 1)) { m_bench_job[bench_algo] = new Job(false, Algorithm(ba2a[bench_algo]), "benchmark"); } } -Benchmark::~Benchmark() { +MoBenchmark::~MoBenchmark() { for (BenchAlgo bench_algo = BenchAlgo::MIN; bench_algo != BenchAlgo::MAX; bench_algo = static_cast(bench_algo + 1)) { delete m_bench_job[bench_algo]; } } // start performance measurements from the first bench_algo -void Benchmark::start() { +void MoBenchmark::start() { JobResults::setListener(this, m_controller->config()->cpu().isHwAES()); // register benchmark as job result listener to compute hashrates there // write text before first benchmark round LOG_INFO("%s " BRIGHT_BLACK_BG(CYAN_BOLD_S " STARTING ALGO PERFORMANCE CALIBRATION (with " MAGENTA_BOLD_S "%i" CYAN_BOLD_S " seconds round) "), Tags::benchmark(), m_controller->config()->benchAlgoTime()); @@ -57,7 +57,7 @@ void Benchmark::start() { } // end of benchmarks, switch to jobs from the pool (network), fill algo_perf -void Benchmark::finish() { +void MoBenchmark::finish() { for (Algorithm::Id algo = Algorithm::MIN; algo != Algorithm::MAX; algo = static_cast(algo + 1)) { algo_perf[algo] = get_algo_perf(algo); } @@ -69,7 +69,7 @@ void Benchmark::finish() { m_controller->start(); } -rapidjson::Value Benchmark::toJSON(rapidjson::Document &doc) const +rapidjson::Value MoBenchmark::toJSON(rapidjson::Document &doc) const { using namespace rapidjson; auto &allocator = doc.GetAllocator(); @@ -83,7 +83,7 @@ rapidjson::Value Benchmark::toJSON(rapidjson::Document &doc) const return obj; } -void Benchmark::read(const rapidjson::Value &value) +void MoBenchmark::read(const rapidjson::Value &value) { for (Algorithm::Id algo = Algorithm::MIN; algo != Algorithm::MAX; algo = static_cast(algo + 1)) { algo_perf[algo] = 0.0f; @@ -110,7 +110,7 @@ void Benchmark::read(const rapidjson::Value &value) } } -double Benchmark::get_algo_perf(Algorithm::Id algo) const { +double MoBenchmark::get_algo_perf(Algorithm::Id algo) const { switch (algo) { case Algorithm::CN_CCX: return m_bench_algo_perf[BenchAlgo::CN_CCX]; case Algorithm::CN_0: return m_bench_algo_perf[BenchAlgo::CN_CCX] / 2; @@ -132,21 +132,19 @@ double Benchmark::get_algo_perf(Algorithm::Id algo) const { case Algorithm::CN_PICO_0: return m_bench_algo_perf[BenchAlgo::CN_PICO_0]; case Algorithm::CN_PICO_TLO: return m_bench_algo_perf[BenchAlgo::CN_PICO_0]; case Algorithm::CN_GPU: return m_bench_algo_perf[BenchAlgo::CN_GPU]; - case Algorithm::AR2_CHUKWA: return m_bench_algo_perf[BenchAlgo::AR2_CHUKWA]; - case Algorithm::AR2_WRKZ: return m_bench_algo_perf[BenchAlgo::AR2_WRKZ]; + case Algorithm::AR2_CHUKWA_V2: return m_bench_algo_perf[BenchAlgo::AR2_CHUKWA_V2]; case Algorithm::ASTROBWT_DERO: return m_bench_algo_perf[BenchAlgo::ASTROBWT_DERO]; case Algorithm::RX_0: return m_bench_algo_perf[BenchAlgo::RX_0]; case Algorithm::RX_SFX: return m_bench_algo_perf[BenchAlgo::RX_0]; case Algorithm::RX_WOW: return m_bench_algo_perf[BenchAlgo::RX_WOW]; case Algorithm::RX_ARQ: return m_bench_algo_perf[BenchAlgo::RX_ARQ]; - case Algorithm::RX_KEVA: return m_bench_algo_perf[BenchAlgo::RX_KEVA]; case Algorithm::RX_XLA: return m_bench_algo_perf[BenchAlgo::RX_XLA]; default: return 0.0f; } } // start performance measurements for specified perf bench_algo -void Benchmark::start(const BenchAlgo bench_algo) { +void MoBenchmark::start(const BenchAlgo bench_algo) { // calculate number of active miner backends in m_enabled_backend_count m_enabled_backend_count = 0; const Algorithm algo(ba2a[bench_algo]); @@ -173,7 +171,7 @@ void Benchmark::start(const BenchAlgo bench_algo) { } // run next bench algo or finish benchmark for the last one -void Benchmark::run_next_bench_algo(const BenchAlgo bench_algo) { +void MoBenchmark::run_next_bench_algo(const BenchAlgo bench_algo) { const BenchAlgo next_bench_algo = static_cast(bench_algo + 1); // compute next perf bench_algo to benchmark if (next_bench_algo != BenchAlgo::MAX) { start(next_bench_algo); @@ -182,7 +180,7 @@ void Benchmark::run_next_bench_algo(const BenchAlgo bench_algo) { } } -void Benchmark::onJobResult(const JobResult& result) { +void MoBenchmark::onJobResult(const JobResult& result) { if (result.clientId != String("benchmark")) { // switch to network pool jobs JobResults::setListener(m_controller->network(), m_controller->config()->cpu().isHwAES()); static_cast(m_controller->network())->onJobResult(result); @@ -221,7 +219,7 @@ void Benchmark::onJobResult(const JobResult& result) { } } -uint64_t Benchmark::get_now() const { // get current time in ms +uint64_t MoBenchmark::get_now() const { // get current time in ms using namespace std::chrono; return time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); } diff --git a/src/core/Benchmark.h b/src/core/MoBenchmark.h similarity index 87% rename from src/core/Benchmark.h rename to src/core/MoBenchmark.h index 5a8feb73..260337c9 100644 --- a/src/core/Benchmark.h +++ b/src/core/MoBenchmark.h @@ -28,7 +28,7 @@ class Controller; class Miner; class Job; -class Benchmark : public IJobResultListener { +class MoBenchmark : public IJobResultListener { enum BenchAlgo : int { CN_R, // "cn/r" CryptoNightR (Monero's variant 4). @@ -38,13 +38,11 @@ class Benchmark : public IJobResultListener { CN_PICO_0, // "cn-pico" CryptoNight-Pico. CN_CCX, // "cn/ccx" Conceal (CCX). CN_GPU, // "cn/gpu" CryptoNight-GPU (Ryo). - AR2_CHUKWA, // "argon2/chukwa" Argon2id (Chukwa). - AR2_WRKZ, // "argon2/wrkz" Argon2id (WRKZ). + AR2_CHUKWA_V2, // "argon2/chukwav2" Argon2id (Chukwa v2). ASTROBWT_DERO, // "astrobwt" AstroBWT (Dero). RX_0, // "rx/0" RandomX (Monero). RX_WOW, // "rx/wow" RandomWOW (Wownero). RX_ARQ, // "rx/arq" RandomARQ (Arqma). - RX_KEVA, // "rx/keva" RandomKEVA (Keva). RX_XLA, // "panthera" Panthera (Scala2). MAX, MIN = 0, @@ -59,13 +57,11 @@ class Benchmark : public IJobResultListener { Algorithm::CN_PICO_0, Algorithm::CN_CCX, Algorithm::CN_GPU, - Algorithm::AR2_CHUKWA, - Algorithm::AR2_WRKZ, + Algorithm::AR2_CHUKWA_V2, Algorithm::ASTROBWT_DERO, Algorithm::RX_0, Algorithm::RX_WOW, Algorithm::RX_ARQ, - Algorithm::RX_KEVA, Algorithm::RX_XLA, }; @@ -74,7 +70,7 @@ class Benchmark : public IJobResultListener { Controller* m_controller; // to get access to config and network bool m_isNewBenchRun; // true if benchmark is need to be executed or was executed - Benchmark::BenchAlgo m_bench_algo; // current perf algo we benchmark + MoBenchmark::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 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 @@ -83,14 +79,14 @@ class Benchmark : public IJobResultListener { uint64_t get_now() const; // get current time in ms double 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 start(const MoBenchmark::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(); - virtual ~Benchmark(); + MoBenchmark(); + virtual ~MoBenchmark(); void set_controller(Controller* controller) { m_controller = controller; } diff --git a/src/core/config/Config.h b/src/core/config/Config.h index f4e91f30..b5557d4d 100644 --- a/src/core/config/Config.h +++ b/src/core/config/Config.h @@ -34,7 +34,7 @@ #include "base/kernel/config/BaseConfig.h" #include "base/tools/Object.h" #ifdef XMRIG_FEATURE_BENCHMARK -#include "core/Benchmark.h" +#include "core/MoBenchmark.h" #endif