MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / runBenchmark

Method runBenchmark

tools/benchmark/benchmark_runner.cpp:63–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void BenchmarkRunner::runBenchmark(Benchmark* benchmark) const {
64 spdlog::info(
65 "Running benchmark {} with {} thread", // NOLINT(clang-analyzer-optin.cplusplus.UninitializedObject):
66 // spdlog has an unitialized object.
67 benchmark->name, config->numThreads);
68 if (!benchmark->preRun.empty()) {
69 spdlog::info("Prerun. {}", benchmark->preRun);
70 benchmark->conn->query(benchmark->preRun);
71 }
72 for (auto i = 0u; i < config->numWarmups; ++i) {
73 spdlog::info("Warm up");
74 benchmark->run();
75 }
76 profileQueryIfEnabled(benchmark);
77 std::vector<double> runTimes(config->numRuns);
78 for (auto i = 0u; i < config->numRuns; ++i) {
79 auto queryResult = benchmark->run();
80 benchmark->log(i + 1, *queryResult);
81 runTimes[i] = queryResult->getQuerySummary()->getExecutionTime();
82 }
83 spdlog::info("Time Taken (Average of Last {} runs) (ms): {}", config->numRuns,
84 computeAverageOfLastRuns(&runTimes[0], config->numRuns,
85 config->numRuns /* numRunsToAverage */));
86 if (!benchmark->postRun.empty()) {
87 spdlog::info("PostRun. {}", benchmark->postRun);
88 benchmark->conn->query(benchmark->postRun);
89 }
90}
91
92void BenchmarkRunner::profileQueryIfEnabled(Benchmark* benchmark) const {
93 if (config->enableProfile && !config->outputPath.empty()) {

Callers

nothing calls this directly

Calls 6

logMethod · 0.80
getQuerySummaryMethod · 0.80
emptyMethod · 0.45
queryMethod · 0.45
runMethod · 0.45
getExecutionTimeMethod · 0.45

Tested by

no test coverage detected