Add ARMNN logging level support 58/253358/2
authorInki Dae <inki.dae@samsung.com>
Tue, 9 Feb 2021 07:11:27 +0000 (16:11 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 10 Feb 2021 01:28:27 +0000 (10:28 +0900)
ARMNN runtime engine supports five step logging levels.
This patch allows user to change the logging level at build time.

Change-Id: I621158be707f21dbd357da24ee00e271b34692b8
Signed-off-by: Inki Dae <inki.dae@samsung.com>
CMakeLists.txt
packaging/inference-engine-armnn.spec
src/inference_engine_armnn.cpp

index 56f697b23ea4c7c3b61debd73e3a47de16e5f532..b00cc3b50261c249ff076b60fb4ede28b5f192cd 100644 (file)
@@ -41,6 +41,8 @@ IF (${ARMNN_GRAPH_DEBUG})
     ADD_DEFINITIONS(-DGRAPH_DEBUG)
 ENDIF()
 
+ADD_DEFINITIONS(-DARMNN_LOG_LEVEL=${ARMNN_LOG_LEVEL})
+
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 
 aux_source_directory(src SOURCES)
index 7b1adc50cb01535a32cbba8778488cc6d6864624..cfcc70a18ecff728db9a41e4bfee6cf1db8c7522 100644 (file)
@@ -14,7 +14,9 @@ BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(inference-engine-interface-common)
 BuildRequires: pkgconfig(armnn)
 
-%define build_options -DARMNN_GRAPH_DEBUG=0
+# Log levels of ARMNN_LOG
+# Trace = 0, Debug = 1, Info = 2, Warning = 3, Error = 4, Fatal = 5
+%define build_options -DARMNN_GRAPH_DEBUG=0 -DARMNN_LOG_LEVEL=2
 
 %description
 ARM Neural Network Runtime based implementation of inference-engine-interface
index f2e2d075e75d8006c818a032c05ef73a40fd6390..a1be6dd885701a69fa47cc76157350e1f0f212fb 100644 (file)
@@ -28,6 +28,8 @@
 #include <armnn/backends/ITensorHandle.hpp>
 #include <armnnTfLiteParser/ITfLiteParser.hpp>
 
+#define LOG_LEVEL      ARMNN_LOG_LEVEL
+
 namespace InferenceEngineImpl
 {
 namespace ARMNNImpl
@@ -40,6 +42,10 @@ namespace ARMNNImpl
                mCLTuner()
        {
                LOGI("ENTER");
+
+               armnn::ConfigureLogging(true, true, static_cast<armnn::LogSeverity>(LOG_LEVEL));
+               LOGI("ARMNN Logging level = %d", LOG_LEVEL);
+
                LOGI("LEAVE");
        }