aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-11-30 14:17:29 -0500
committerAndrew Chow <github@achow101.com>2023-11-30 14:28:46 -0500
commit498994b6f55d04a7940f832e7fbd17e5acdaff15 (patch)
tree10451ec061f4456b88d0c3a2d0d3c8c4c3db2b44 /src/bench
parentffb021612b8f581cbbaffacc80922d1bc5683706 (diff)
parent5b3ea5fa2e7f6dc1c9161ed8b74c9be4bd1e92dd (diff)
Merge bitcoin/bitcoin#26762: bugfix: Make `CCheckQueue` RAII-styled (attempt 2)
5b3ea5fa2e7f6dc1c9161ed8b74c9be4bd1e92dd refactor: Move `{MAX,DEFAULT}_SCRIPTCHECK_THREADS` constants (Hennadii Stepanov) 6e17b3168072ab77ed7170ab81327c017877133a refactor: Make `CCheckQueue` non-copyable and non-movable explicitly (Hennadii Stepanov) 8111e74653dc5c93cb510672d99048c3f741d8dc refactor: Drop unneeded declaration (Hennadii Stepanov) 9cf89f7a5b81197e38f58b24be0793b28fe41477 refactor: Make `CCheckQueue` constructor start worker threads (Hennadii Stepanov) d03eaacbcfb276fb638db1b423113ff43bd7ec41 Make `CCheckQueue` destructor stop worker threads (Hennadii Stepanov) be4ff3060b7b43b496dfb5a2c02b114b2b717106 Move global `scriptcheckqueue` into `ChainstateManager` class (Hennadii Stepanov) Pull request description: This PR: - makes `CCheckQueue` RAII-styled - gets rid of the global `scriptcheckqueue` - fixes https://github.com/bitcoin/bitcoin/issues/25448 The previous attempt was in https://github.com/bitcoin/bitcoin/pull/18731. ACKs for top commit: martinus: ACK 5b3ea5fa2e7 achow101: ACK 5b3ea5fa2e7f6dc1c9161ed8b74c9be4bd1e92dd TheCharlatan: ACK 5b3ea5fa2e7f6dc1c9161ed8b74c9be4bd1e92dd Tree-SHA512: 45cca846e7ed107e3930149f0b616ddbaf2648d6cde381f815331b861b5d67ab39e154883ae174b8abb1dae485bc904318c50c51e5d6b46923d89de51c5eadb0
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/checkqueue.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bench/checkqueue.cpp b/src/bench/checkqueue.cpp
index 70e0b86eba..114dd9d39c 100644
--- a/src/bench/checkqueue.cpp
+++ b/src/bench/checkqueue.cpp
@@ -37,10 +37,11 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
return true;
}
};
- CCheckQueue<PrevectorJob> queue {QUEUE_BATCH_SIZE};
+
// The main thread should be counted to prevent thread oversubscription, and
// to decrease the variance of benchmark results.
- queue.StartWorkerThreads(GetNumCores() - 1);
+ int worker_threads_num{GetNumCores() - 1};
+ CCheckQueue<PrevectorJob> queue{QUEUE_BATCH_SIZE, worker_threads_num};
// create all the data once, then submit copies in the benchmark.
FastRandomContext insecure_rand(true);
@@ -61,7 +62,6 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
// it is done explicitly here for clarity
control.Wait();
});
- queue.StopWorkerThreads();
ECC_Stop();
}
BENCHMARK(CCheckQueueSpeedPrevectorJob, benchmark::PriorityLevel::HIGH);