MCPcopy Create free account
hub / github.com/boost-ext/ut / benchmark

Class benchmark

example/benchmark.cpp:15–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14namespace benchmark {
15struct benchmark : boost::ut::detail::test {
16 explicit benchmark(std::string_view _name)
17 : boost::ut::detail::test{"benchmark", _name} {}
18
19 template <class Test>
20 auto operator=(Test _test) {
21 static_cast<boost::ut::detail::test&>(*this) = [&_test, this] {
22 const auto start = std::chrono::high_resolution_clock::now();
23 _test();
24 const auto stop = std::chrono::high_resolution_clock::now();
25 const auto ns =
26 std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);
27 std::clog << "[" << name << "] " << ns.count() << " ns\n";
28 };
29 }
30};
31
32[[nodiscard]] auto operator""_benchmark(const char* _name,
33 decltype(sizeof("")) size) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected