From 0828a900e116ba04e5a2c6f838d6dcd8997cd1da Mon Sep 17 00:00:00 2001 From: Hariharan Seshadri Date: Mon, 3 Aug 2020 15:25:55 -0700 Subject: [PATCH] Support easy way to request verbose logging in test runner (#4676) --- onnxruntime/test/onnx/main.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/onnxruntime/test/onnx/main.cc b/onnxruntime/test/onnx/main.cc index 63540c28c6..e1258f4e72 100644 --- a/onnxruntime/test/onnx/main.cc +++ b/onnxruntime/test/onnx/main.cc @@ -107,9 +107,10 @@ int real_main(int argc, char* argv[], Ort::Env& env) { int device_id = 0; GraphOptimizationLevel graph_optimization_level = ORT_ENABLE_ALL; bool user_graph_optimization_level_set = false; - int verbosity_option_count = 0; OrtLoggingLevel logging_level = ORT_LOGGING_LEVEL_ERROR; + bool verbose_logging_required = false; + bool pause = false; { int ch; @@ -119,7 +120,7 @@ int real_main(int argc, char* argv[], Ort::Env& env) { enable_cpu_mem_arena = false; break; case 'v': - verbosity_option_count += 1; + verbose_logging_required = true; break; case 'c': concurrent_session_runs = static_cast(OrtStrtol(optarg, nullptr)); @@ -230,10 +231,12 @@ int real_main(int argc, char* argv[], Ort::Env& env) { } } - // set log level based on number of verbosity options - logging_level = - static_cast(static_cast(ORT_LOGGING_LEVEL_ERROR) - - std::min(verbosity_option_count, static_cast(ORT_LOGGING_LEVEL_ERROR))); + // TODO: Support specifying all valid levels of logging + // Currently the logging level is ORT_LOGGING_LEVEL_ERROR by default and + // if the user adds -v, the logging level is ORT_LOGGING_LEVEL_VERBOSE + if (verbose_logging_required) { + logging_level = ORT_LOGGING_LEVEL_VERBOSE; + } if (concurrent_session_runs > 1 && repeat_count > 1) { fprintf(stderr, "when you use '-r [repeat]', please set '-c' to 1\n");