| 270 | } |
| 271 | |
| 272 | void BenchmarkPerformanceOptions::Run(int argc, char** argv) { |
| 273 | // We first parse flags for single-option runs to get information like |
| 274 | // parameters of the input model etc. |
| 275 | if (single_option_run_->ParseFlags(&argc, argv) != kTfLiteOk) return; |
| 276 | |
| 277 | // Now, we parse flags that are specified for this particular binary. |
| 278 | if (!ParseFlags(&argc, argv)) return; |
| 279 | |
| 280 | // Now, the remaining are unrecognized flags and we simply print them out. |
| 281 | for (int i = 1; i < argc; ++i) { |
| 282 | TFLITE_LOG(WARN) << "WARNING: unrecognized commandline flag: " << argv[i]; |
| 283 | } |
| 284 | |
| 285 | CreatePerformanceOptions(); |
| 286 | |
| 287 | if (params_.Get<bool>("random_shuffle_benchmark_runs")) { |
| 288 | std::random_shuffle(all_run_params_.begin(), all_run_params_.end()); |
| 289 | } |
| 290 | |
| 291 | // Now perform all runs, each with different performance-affecting parameters. |
| 292 | for (const auto& run_params : all_run_params_) { |
| 293 | // Reset all performance-related options before any runs. |
| 294 | ResetPerformanceOptions(); |
| 295 | single_option_run_params_->Set(run_params); |
| 296 | util::SleepForSeconds(params_.Get<float>("option_benchmark_run_delay")); |
| 297 | single_option_run_->Run(); |
| 298 | } |
| 299 | |
| 300 | all_run_stats_->OutputStats(); |
| 301 | } |
| 302 | } // namespace benchmark |
| 303 | } // namespace tflite |
nothing calls this directly
no test coverage detected