diff --git a/src/metrics.cpp b/src/metrics.cpp index fd8000548..db0d1965d 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -45,6 +45,12 @@ bool AtomicTimer::running() return threads > 0; } +uint64_t AtomicTimer::threadCount() +{ + std::unique_lock lock(mtx); + return threads; +} + double AtomicTimer::rate(const AtomicCounter& count) { std::unique_lock lock(mtx); @@ -191,15 +197,8 @@ int printMiningStatus(bool mining) int lines = 1; if (mining) { - int nThreads = GetArg("-genproclimit", 1); - if (nThreads < 0) { - // In regtest threads defaults to 1 - if (Params().DefaultMinerThreads()) - nThreads = Params().DefaultMinerThreads(); - else - nThreads = boost::thread::hardware_concurrency(); - } - if (miningTimer.running()) { + auto nThreads = miningTimer.threadCount(); + if (nThreads > 0) { std::cout << strprintf(_("You are mining with the %s solver on %d threads."), GetArg("-equihashsolver", "default"), nThreads) << std::endl; } else { diff --git a/src/metrics.h b/src/metrics.h index 3e830f823..701306a4a 100644 --- a/src/metrics.h +++ b/src/metrics.h @@ -49,6 +49,8 @@ public: bool running(); + uint64_t threadCount(); + double rate(const AtomicCounter& count); };