Auto merge of #2227 - str4d:2074-ignore-virtual-cores, r=str4d

Use real number of cores, ignore virtual cores

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6361
- bitcoin/bitcoin#6370

Part of #2074.
This commit is contained in:
Homu
2017-06-15 17:05:02 -07:00
8 changed files with 31 additions and 24 deletions

View File

@@ -46,6 +46,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);
@@ -192,15 +198,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 {