| 41 | } |
| 42 | |
| 43 | BenchmarkOptions ParseBenchmarkOptions(const std::vector<std::string>& args) { |
| 44 | BenchmarkOptions options; |
| 45 | |
| 46 | for (size_t i = 0; i < args.size(); ++i) { |
| 47 | const std::string& arg = args[i]; |
| 48 | if (arg == "--test" || arg == "-t") { |
| 49 | if (i + 1 >= args.size()) { |
| 50 | throw std::runtime_error("Missing value for --test"); |
| 51 | } |
| 52 | options.filter_test = args[++i]; |
| 53 | } else if (arg == "--omp-threads") { |
| 54 | if (i + 1 >= args.size()) { |
| 55 | throw std::runtime_error("Missing value for --omp-threads"); |
| 56 | } |
| 57 | options.omp_threads = ParseThreadArg("--omp-threads", args[++i]); |
| 58 | } else if (arg == "--ff-threads") { |
| 59 | if (i + 1 >= args.size()) { |
| 60 | throw std::runtime_error("Missing value for --ff-threads"); |
| 61 | } |
| 62 | options.ff_threads = ParseThreadArg("--ff-threads", args[++i]); |
| 63 | } else if (arg == "--list" || arg == "-l") { |
| 64 | options.list_only = true; |
| 65 | } else if (arg == "--help" || arg == "-h") { |
| 66 | options.show_help = true; |
| 67 | } else { |
| 68 | throw std::runtime_error("Unknown argument: " + arg); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | return options; |
| 73 | } |
| 74 | |
| 75 | } // namespace benchmark |
| 76 | } // namespace openshot |
no test coverage detected