Use AtomicTimer for metrics screen thread count
This commit is contained in:
parent
2854c4e366
commit
0d0265fd11
|
@ -45,6 +45,12 @@ bool AtomicTimer::running()
|
|||
return threads > 0;
|
||||
}
|
||||
|
||||
uint64_t AtomicTimer::threadCount()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
return threads;
|
||||
}
|
||||
|
||||
double AtomicTimer::rate(const AtomicCounter& count)
|
||||
{
|
||||
std::unique_lock<std::mutex> 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 {
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
|
||||
bool running();
|
||||
|
||||
uint64_t threadCount();
|
||||
|
||||
double rate(const AtomicCounter& count);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue