| 61 | } |
| 62 | |
| 63 | void 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 | |
| 92 | void BenchmarkRunner::profileQueryIfEnabled(Benchmark* benchmark) const { |
| 93 | if (config->enableProfile && !config->outputPath.empty()) { |
nothing calls this directly
no test coverage detected