mv_machine_learning: apply inference engine profiler support 13/270313/3
authorInki Dae <inki.dae@samsung.com>
Fri, 28 Jan 2022 04:04:58 +0000 (13:04 +0900)
committerInki Dae <inki.dae@samsung.com>
Fri, 28 Jan 2022 08:57:01 +0000 (17:57 +0900)
[Version] : 0.14.0-0
[Issue type] : new feature

Applied inference engine profiler support which provides
a build option for disabling or enabling inference engine profiler
in runtime. In default the profiler is disabled.

Change-Id: Ie85c078c52bf6f23017e50d91158af9b4a37d113
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/mv_inference/inference/CMakeLists.txt
mv_machine_learning/mv_inference/inference/src/Inference.cpp
packaging/capi-media-vision.spec

index cd20e571f058d52f79189050f1d54f15729749fa..f9eae6d271b119eb1a44466fb43c7839fb259c6d 100644 (file)
@@ -16,6 +16,11 @@ else()
        add_library(${PROJECT_NAME} SHARED ${MV_INFERENCE_SOURCE_LIST})
 endif()
 
+IF (${ENABLE_INFERENCE_PROFILER})
+    MESSAGE("Enabled Mediavision Inference Engine Profiler.")
+    ADD_DEFINITIONS(-DENABLE_INFERENCE_PROFILER)
+ENDIF()
+
 target_link_libraries(${PROJECT_NAME} ${MV_COMMON_LIB_NAME} ${OpenCV_LIBS} ${${PROJECT_NAME}_DEP_LIBRARIES})
 target_include_directories(${PROJECT_NAME} PRIVATE include)
 install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
index b23b7338d89d4636cbf4b47036b691b383b20200..f56d6c558f39966640089082ee2536bc3349cc7b 100755 (executable)
@@ -817,6 +817,11 @@ namespace inference
                // Create a backend class object.
                try {
                        mBackend = new InferenceEngineCommon();
+
+#if ENABLE_INFERENCE_PROFILER
+                       mBackend->EnableProfiler(true);
+                       mBackend->DumpProfileToFile("profile_data_" + backendName + ".txt");
+#endif
                } catch (const std::bad_alloc &ex) {
                        LOGE("Fail to create backend : %s", ex.what());
                        return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
index 0e289da3171cd4dbaf091fe14113f6d184c49dc1..a7308035f5a5a6ca91b07978e51e0cc32d2b210c 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.13.2
+Version:     0.14.0
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause
@@ -31,6 +31,11 @@ BuildRequires: pkgconfig(ncurses)
 BuildRequires: gtest-devel
 %endif
 
+# Build options
+# ENABLE_INFERENCE_PROFILER
+# 0 : disable Mediavision inference engine profiler, 1 : enable Mediavision inference engine profiler.
+%define build_options -DENABLE_INFERENCE_PROFILER=0
+
 Requires:   %{name}-machine_learning
 %if !0%{?ml_only:1}
 Requires:   %{name}-barcode
@@ -206,7 +211,7 @@ export FFLAGS+=" -fprofile-arcs -ftest-coverage"
 export LDFLAGS+=" -lgcov"
 %endif
 
-%cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+%cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo %{build_options} \
 %if 0%{?ml_only:1}
  -DBUILD_ML_ONLY=ON \
 %endif