| 14 | } |
| 15 | |
| 16 | int main(int argc, char** argv) { |
| 17 | std::string datasetPath; |
| 18 | std::string benchmarkPath; |
| 19 | auto config = std::make_unique<BenchmarkConfig>(); |
| 20 | // parse arguments |
| 21 | for (auto i = 1; i < argc; ++i) { |
| 22 | std::string arg = argv[i]; |
| 23 | if (arg.starts_with("--dataset")) { |
| 24 | datasetPath = getArgumentValue(arg); |
| 25 | } else if (arg.starts_with("--benchmark")) { |
| 26 | benchmarkPath = getArgumentValue(arg); |
| 27 | } else if (arg.starts_with("--warmup")) { |
| 28 | config->numWarmups = stoul(getArgumentValue(arg)); |
| 29 | } else if (arg.starts_with("--run")) { |
| 30 | config->numRuns = stoul(getArgumentValue(arg)); |
| 31 | } else if (arg.starts_with("--thread")) { |
| 32 | config->numThreads = stoul(getArgumentValue(arg)); |
| 33 | } else if (arg.starts_with("--out")) { // save benchmark result to file |
| 34 | config->outputPath = getArgumentValue(arg); |
| 35 | } else if (arg.starts_with("--profile")) { |
| 36 | config->enableProfile = true; |
| 37 | } else if (arg.starts_with("--bm-size")) { |
| 38 | config->bufferPoolSize = (uint64_t)stoull(getArgumentValue(arg)) << 20; |
| 39 | } else { |
| 40 | printf("Unrecognized option %s", arg.c_str()); |
| 41 | return 1; |
| 42 | } |
| 43 | } |
| 44 | if (datasetPath.empty()) { |
| 45 | printf("Missing --dataset input."); |
| 46 | return 1; |
| 47 | } |
| 48 | if (benchmarkPath.empty()) { |
| 49 | printf("Missing --benchmark input"); |
| 50 | return 1; |
| 51 | } |
| 52 | auto runner = BenchmarkRunner(datasetPath, std::move(config)); |
| 53 | try { |
| 54 | runner.registerBenchmarks(benchmarkPath); |
| 55 | } catch (std::exception& e) { |
| 56 | spdlog::error("Error encountered while registering benchmark in {}: {}.", benchmarkPath, |
| 57 | e.what()); |
| 58 | } |
| 59 | runner.runAllBenchmarks(); |
| 60 | return 0; |
| 61 | } |
nothing calls this directly
no test coverage detected