8 #include "validation.h" 12 #include <boost/thread/thread.hpp> 19 static const int MIN_CORES = 2;
20 static const size_t BATCHES = 101;
21 static const size_t BATCH_SIZE = 30;
22 static const int PREVECTOR_SIZE = 28;
23 static const int QUEUE_BATCH_SIZE = 128;
26 struct FakeJobNoWork {
31 void swap(FakeJobNoWork& x){};
34 boost::thread_group tg;
35 for (
auto x = 0; x < std::max(MIN_CORES,
GetNumCores()); ++x) {
36 tg.create_thread([&]{queue.Thread();});
44 std::vector<std::vector<FakeJobNoWork>> vBatches(BATCHES);
45 for (
auto& vChecks : vBatches) {
46 vChecks.resize(BATCH_SIZE);
48 for (
auto& vChecks : vBatches) {
78 void swap(PrevectorJob& x){p.
swap(x.p);};
81 boost::thread_group tg;
82 for (
auto x = 0; x < std::max(MIN_CORES,
GetNumCores()); ++x) {
83 tg.create_thread([&]{queue.Thread();});
89 std::vector<std::vector<PrevectorJob>> vBatches(BATCHES);
90 for (
auto& vChecks : vBatches) {
91 vChecks.reserve(BATCH_SIZE);
92 for (
size_t x = 0; x < BATCH_SIZE; ++x)
93 vChecks.emplace_back(insecure_rand);
void resize(size_type new_size)
uint64_t randrange(uint64_t range)
Generate a random integer in the range [0..range).
RAII-style controller object for a CCheckQueue that guarantees the passed queue is finished before co...
void swap(prevector< N, T, Size, Diff > &other)
Queue for verifications that have to be performed.
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
BENCHMARK(CCheckQueueSpeed)
int GetNumCores()
Return the number of physical cores available on the current system.