| 279 | using duration = std::chrono::duration<float>; |
| 280 | |
| 281 | int main(int argc, char** argv) |
| 282 | { |
| 283 | std::string const sampleName = "TensorRT.trtexec"; |
| 284 | |
| 285 | auto sampleTest = sample::gLogger.defineTest(sampleName, argc, argv); |
| 286 | |
| 287 | try |
| 288 | { |
| 289 | sample::gLogger.reportTestStart(sampleTest); |
| 290 | |
| 291 | Arguments args = argsToArgumentsMap(argc, argv); |
| 292 | AllOptions options; |
| 293 | |
| 294 | if (parseHelp(args)) |
| 295 | { |
| 296 | AllOptions::help(std::cout); |
| 297 | return EXIT_SUCCESS; |
| 298 | } |
| 299 | |
| 300 | if (!args.empty()) |
| 301 | { |
| 302 | bool failed{false}; |
| 303 | try |
| 304 | { |
| 305 | options.parse(args); |
| 306 | |
| 307 | if (!args.empty()) |
| 308 | { |
| 309 | for (auto const& arg : args) |
| 310 | { |
| 311 | sample::gLogError << "Unknown option: " << arg.first << " " << arg.second << std::endl; |
| 312 | } |
| 313 | failed = true; |
| 314 | } |
| 315 | } |
| 316 | catch (std::invalid_argument const& arg) |
| 317 | { |
| 318 | sample::gLogError << arg.what() << std::endl; |
| 319 | failed = true; |
| 320 | } |
| 321 | |
| 322 | if (failed) |
| 323 | { |
| 324 | AllOptions::help(std::cout); |
| 325 | return sample::gLogger.reportFail(sampleTest); |
| 326 | } |
| 327 | } |
| 328 | else |
| 329 | { |
| 330 | options.helps = true; |
| 331 | } |
| 332 | |
| 333 | if (options.helps) |
| 334 | { |
| 335 | AllOptions::help(std::cout); |
| 336 | return sample::gLogger.reportPass(sampleTest); |
| 337 | } |
| 338 |
nothing calls this directly
no test coverage detected