9#include <test/util/setup_common.h>
19using namespace std::chrono_literals;
30 std::ofstream
fout{file};
33 std::cout <<
"Created " << file << std::endl;
35 std::cout <<
"Could not write to file " << file << std::endl;
48 benchmarks().insert(std::make_pair(
name, func));
57 for (
const auto &
p : benchmarks()) {
63 std::cout <<
p.first << std::endl;
82 std::cout <<
bench.complexityBigO() << std::endl;
89 "# Benchmark, evals, iterations, total, min, max, median\n"
90 "{{#result}}{{name}}, {{epochs}}, {{average(iterations)}}, "
91 "{{sumProduct(iterations, elapsed)}}, {{minimum(elapsed)}}, "
92 "{{maximum(elapsed)}}, {{median(elapsed)}}\n"
Main entry point to nanobench's benchmarking facility.
ANKERL_NANOBENCH(NODISCARD) std Bench & name(char const *benchmarkName)
Name of the benchmark, will be shown in the table row.
static BenchmarkMap & benchmarks()
static void RunAll(const Args &args)
std::map< std::string, BenchFunction > BenchmarkMap
BenchRunner(std::string name, BenchFunction func)
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
char const * json() noexcept
Template to generate JSON data.
void render(char const *mustacheTemplate, Bench const &bench, std::ostream &out)
Renders output from a mustache-like template and benchmark results.
std::function< void(Bench &)> BenchFunction
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::vector< double > asymptote
std::chrono::milliseconds min_time