Changeset View
Changeset View
Standalone View
Standalone View
src/bench/checkqueue.cpp
Show All 38 Lines | static void CCheckQueueSpeedPrevectorJob(benchmark::State &state) { | ||||
} | } | ||||
while (state.KeepRunning()) { | while (state.KeepRunning()) { | ||||
// Make insecure_rand here so that each iteration is identical. | // Make insecure_rand here so that each iteration is identical. | ||||
FastRandomContext insecure_rand(true); | FastRandomContext insecure_rand(true); | ||||
CCheckQueueControl<PrevectorJob> control(&queue); | CCheckQueueControl<PrevectorJob> control(&queue); | ||||
std::vector<std::vector<PrevectorJob>> vBatches(BATCHES); | std::vector<std::vector<PrevectorJob>> vBatches(BATCHES); | ||||
for (auto &vChecks : vBatches) { | for (auto &vChecks : vBatches) { | ||||
vChecks.reserve(BATCH_SIZE); | vChecks.reserve(BATCH_SIZE); | ||||
for (size_t x = 0; x < BATCH_SIZE; ++x) | for (size_t x = 0; x < BATCH_SIZE; ++x) { | ||||
vChecks.emplace_back(insecure_rand); | vChecks.emplace_back(insecure_rand); | ||||
} | |||||
control.Add(vChecks); | control.Add(vChecks); | ||||
} | } | ||||
// control waits for completion by RAII, but it is done explicitly here | // control waits for completion by RAII, but it is done explicitly here | ||||
// for clarity | // for clarity | ||||
control.Wait(); | control.Wait(); | ||||
} | } | ||||
tg.interrupt_all(); | tg.interrupt_all(); | ||||
tg.join_all(); | tg.join_all(); | ||||
} | } | ||||
BENCHMARK(CCheckQueueSpeedPrevectorJob, 1400); | BENCHMARK(CCheckQueueSpeedPrevectorJob, 1400); |