MCPcopy Create free account
hub / github.com/WallBreaker2/op / MeasureBenchmark

Function MeasureBenchmark

tests/opencv_test.cpp:132–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132BenchmarkStats MeasureBenchmark(
133 const std::function<bool()> &operation,
134 bool &ok,
135 int warmup_runs = 1,
136 int measured_runs = 5) {
137 ok = true;
138 for (int index = 0; index < warmup_runs; ++index) {
139 if (!operation()) {
140 ok = false;
141 return {};
142 }
143 }
144
145 std::vector<long long> samples;
146 samples.reserve(static_cast<size_t>(measured_runs));
147 for (int index = 0; index < measured_runs; ++index) {
148 bool run_ok = false;
149 const long long elapsed_ms = MeasureMilliseconds(operation, run_ok);
150 if (!run_ok) {
151 ok = false;
152 samples.clear();
153 return {};
154 }
155 samples.push_back(elapsed_ms);
156 }
157 return BuildBenchmarkStats(std::move(samples));
158}
159
160struct RealImageCase {
161 std::wstring label;

Callers 1

TESTFunction · 0.85

Calls 3

MeasureMillisecondsFunction · 0.85
BuildBenchmarkStatsFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected