mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
bench: Use CCheckQueue local thread pool
This commit is contained in:
parent
dba30695fc
commit
6784ac471b
2 changed files with 2 additions and 14 deletions
|
@ -10,8 +10,6 @@
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
|
||||||
#include <boost/thread/thread.hpp>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
static const size_t BATCHES = 101;
|
static const size_t BATCHES = 101;
|
||||||
|
@ -44,12 +42,9 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
|
||||||
void swap(PrevectorJob& x){p.swap(x.p);};
|
void swap(PrevectorJob& x){p.swap(x.p);};
|
||||||
};
|
};
|
||||||
CCheckQueue<PrevectorJob> queue {QUEUE_BATCH_SIZE};
|
CCheckQueue<PrevectorJob> queue {QUEUE_BATCH_SIZE};
|
||||||
boost::thread_group tg;
|
|
||||||
// The main thread should be counted to prevent thread oversubscription, and
|
// The main thread should be counted to prevent thread oversubscription, and
|
||||||
// to decrease the variance of benchmark results.
|
// to decrease the variance of benchmark results.
|
||||||
for (auto x = 0; x < GetNumCores() - 1; ++x) {
|
queue.StartWorkerThreads(GetNumCores() - 1);
|
||||||
tg.create_thread([&]{queue.Thread();});
|
|
||||||
}
|
|
||||||
|
|
||||||
// create all the data once, then submit copies in the benchmark.
|
// create all the data once, then submit copies in the benchmark.
|
||||||
FastRandomContext insecure_rand(true);
|
FastRandomContext insecure_rand(true);
|
||||||
|
@ -70,8 +65,7 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
|
||||||
// it is done explicitly here for clarity
|
// it is done explicitly here for clarity
|
||||||
control.Wait();
|
control.Wait();
|
||||||
});
|
});
|
||||||
tg.interrupt_all();
|
queue.StopWorkerThreads();
|
||||||
tg.join_all();
|
|
||||||
ECC_Stop();
|
ECC_Stop();
|
||||||
}
|
}
|
||||||
BENCHMARK(CCheckQueueSpeedPrevectorJob);
|
BENCHMARK(CCheckQueueSpeedPrevectorJob);
|
||||||
|
|
|
@ -159,12 +159,6 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Worker thread
|
|
||||||
void Thread()
|
|
||||||
{
|
|
||||||
Loop(false /* worker thread */);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Wait until execution finishes, and return whether all evaluations were successful.
|
//! Wait until execution finishes, and return whether all evaluations were successful.
|
||||||
bool Wait()
|
bool Wait()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue