mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 11:13:02 +02:00
Merge #18710: Add local thread pool to CCheckQueue
bb6fcc75d1refactor: Drop boost::thread stuff in CCheckQueue (Hennadii Stepanov)6784ac471bbench: Use CCheckQueue local thread pool (Hennadii Stepanov)dba30695fctest: Use CCheckQueue local thread pool (Hennadii Stepanov)01511776acAdd local thread pool to CCheckQueue (Hennadii Stepanov)0ef938685brefactor: Use member initializers in CCheckQueue (Hennadii Stepanov) Pull request description: This PR: - gets rid of `boost::thread_group` in the `CCheckQueue` class - allows thread safety annotation usage in the `CCheckQueue` class - is alternative to #14464 (https://github.com/bitcoin/bitcoin/pull/18710#issuecomment-616618525, https://github.com/bitcoin/bitcoin/pull/18710#issuecomment-617291612) Also, with this PR (I hope) it could be easier to resurrect a bunch of brilliant ideas from #9938. Related: #17307 ACKs for top commit: laanwj: Code review ACKbb6fcc75d1LarryRuane: ACKbb6fcc75d1jonatack: Code review ACKbb6fcc75d1and verified rebase to master builds cleanly with unit/functional tests green Tree-SHA512: fddeb720d5a391b48bb4c6fa58ed34ccc3f57862fdb8e641745c021841c8340e35c5126338271446cbd98f40bd5484f27926aa6c3e76fa478ba1efafe72e73c1
This commit is contained in:
@@ -10,8 +10,6 @@
|
||||
#include <random.h>
|
||||
#include <util/system.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
static const size_t BATCHES = 101;
|
||||
@@ -44,12 +42,9 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
|
||||
void swap(PrevectorJob& x){p.swap(x.p);};
|
||||
};
|
||||
CCheckQueue<PrevectorJob> queue {QUEUE_BATCH_SIZE};
|
||||
boost::thread_group tg;
|
||||
// The main thread should be counted to prevent thread oversubscription, and
|
||||
// to decrease the variance of benchmark results.
|
||||
for (auto x = 0; x < GetNumCores() - 1; ++x) {
|
||||
tg.create_thread([&]{queue.Thread();});
|
||||
}
|
||||
queue.StartWorkerThreads(GetNumCores() - 1);
|
||||
|
||||
// create all the data once, then submit copies in the benchmark.
|
||||
FastRandomContext insecure_rand(true);
|
||||
@@ -70,8 +65,7 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
|
||||
// it is done explicitly here for clarity
|
||||
control.Wait();
|
||||
});
|
||||
tg.interrupt_all();
|
||||
tg.join_all();
|
||||
queue.StopWorkerThreads();
|
||||
ECC_Stop();
|
||||
}
|
||||
BENCHMARK(CCheckQueueSpeedPrevectorJob);
|
||||
|
||||
Reference in New Issue
Block a user