| 45 | |
| 46 | template <template <typename, typename> class Beam> |
| 47 | void Benchmark(string const & beamType, uint64_t const numResets, size_t const capacity, uint64_t const numEvents) |
| 48 | { |
| 49 | base::Timer timer; |
| 50 | SCOPE_GUARD(timerGuard, [&] { LOG(LINFO, ("type:", beamType, "\ttime passed:", timer.ElapsedSeconds())); }); |
| 51 | |
| 52 | CHECK_LESS_OR_EQUAL(capacity, numEvents, ()); |
| 53 | |
| 54 | mt19937 rng(0); |
| 55 | uniform_real_distribution<double> dis(0.0, 1.0); |
| 56 | for (uint64_t wave = 0; wave <= numResets; ++wave) |
| 57 | { |
| 58 | Beam<uint64_t, double> beam(capacity); |
| 59 | |
| 60 | uint64_t const begin = wave * numEvents / (numResets + 1); |
| 61 | uint64_t const end = (wave + 1) * numEvents / (numResets + 1); |
| 62 | for (uint64_t i = begin; i < end; ++i) |
| 63 | beam.Add(i, dis(rng)); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | UNIT_TEST(Beam_Smoke) |
| 68 | { |
nothing calls this directly
no test coverage detected