MCPcopy Create free account
hub / github.com/ElementsProject/elements / RunAll

Method RunAll

src/bench/bench.cpp:55–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void benchmark::BenchRunner::RunAll(const Args& args)
56{
57 std::regex reFilter(args.regex_filter);
58 std::smatch baseMatch;
59
60 std::vector<ankerl::nanobench::Result> benchmarkResults;
61 for (const auto& p : benchmarks()) {
62 if (!std::regex_match(p.first, baseMatch, reFilter)) {
63 continue;
64 }
65
66 if (args.is_list_only) {
67 std::cout << p.first << std::endl;
68 continue;
69 }
70
71 Bench bench;
72 bench.name(p.first);
73 if (args.min_time > 0ms) {
74 // convert to nanos before dividing to reduce rounding errors
75 std::chrono::nanoseconds min_time_ns = args.min_time;
76 bench.minEpochTime(min_time_ns / bench.epochs());
77 }
78
79 if (args.asymptote.empty()) {
80 p.second(bench);
81 } else {
82 for (auto n : args.asymptote) {
83 bench.complexityN(n);
84 p.second(bench);
85 }
86 std::cout << bench.complexityBigO() << std::endl;
87 }
88
89 if (!bench.results().empty()) {
90 benchmarkResults.push_back(bench.results().back());
91 }
92 }
93
94 GenerateTemplateResults(benchmarkResults, args.output_csv, "# Benchmark, evals, iterations, total, min, max, median\n"
95 "{{#result}}{{name}}, {{epochs}}, {{average(iterations)}}, {{sumProduct(iterations, elapsed)}}, {{minimum(elapsed)}}, {{maximum(elapsed)}}, {{median(elapsed)}}\n"
96 "{{/result}}");
97 GenerateTemplateResults(benchmarkResults, args.output_json, ankerl::nanobench::templates::json());
98}

Callers

nothing calls this directly

Calls 8

GenerateTemplateResultsFunction · 0.85
jsonFunction · 0.85
minEpochTimeMethod · 0.80
epochsMethod · 0.80
complexityNMethod · 0.80
complexityBigOMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected