MCPcopy Create free account
hub / github.com/comaps/comaps / Benchmark

Function Benchmark

libs/base/base_tests/beam_tests.cpp:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template <template <typename, typename> class Beam>
47void 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
67UNIT_TEST(Beam_Smoke)
68{

Callers

nothing calls this directly

Calls 2

ElapsedSecondsMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected