Add thread-settings for control the thread 10/185410/5
authorhuiyu.eun <huiyu.eun@samsung.com>
Mon, 30 Jul 2018 08:36:03 +0000 (17:36 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Tue, 31 Jul 2018 03:09:50 +0000 (12:09 +0900)
Change-Id: I84c66a6c55d4ebe6ad407ea6128f445db6c68ac1
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
build/tizen/adaptor/Makefile.am
build/tizen/adaptor/module.list
dali/devel-api/adaptor-framework/thread-settings.cpp [new file with mode: 0644]
dali/devel-api/adaptor-framework/thread-settings.h [new file with mode: 0755]
dali/devel-api/file.list
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/thread/common/thread-settings-impl.cpp [new file with mode: 0644]
dali/internal/thread/common/thread-settings-impl.h [new file with mode: 0644]
dali/internal/thread/file.list [new file with mode: 0644]

index a6f050cf2f3fede826d95af9e031abc78968a85a..9c506a9f34891a9cc1ec5ad30e743e214e212d82 100644 (file)
@@ -66,6 +66,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_video_common_src_files) \
                   $(adaptor_window_system_common_src_files) \
                   $(adaptor_trace_common_src_files) \
+                  $(adaptor_thread_common_src_files) \
                   $(adaptor_window_system_ubuntu_x11_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
@@ -119,6 +120,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
                   $(adaptor_trace_common_src_files) \
+                  $(adaptor_thread_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -180,6 +182,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
                   $(adaptor_trace_common_src_files) \
+                  $(adaptor_thread_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -240,6 +243,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
                   $(adaptor_trace_common_src_files) \
+                  $(adaptor_thread_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -299,6 +303,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
                   $(adaptor_trace_common_src_files) \
+                  $(adaptor_thread_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -361,6 +366,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
                   $(adaptor_trace_common_src_files) \
+                  $(adaptor_thread_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
index a326b6e64edb2262a86478381452cb49864922f3..f174bc17f23942c351974e54fe554edf36fee73d 100644 (file)
@@ -63,6 +63,10 @@ include ../../../dali/internal/window-system/file.list
 adaptor_trace_dir = ../../../dali/internal/trace
 include ../../../dali/internal/trace/file.list
 
+# Module: thread
+adaptor_thread_dir = ../../../dali/internal/thread
+include ../../../dali/internal/thread/file.list
+
 # Module: public-api
 adaptor_public_api_dir = ../../../dali/public-api
 include ../../../dali/public-api/file.list
diff --git a/dali/devel-api/adaptor-framework/thread-settings.cpp b/dali/devel-api/adaptor-framework/thread-settings.cpp
new file mode 100644 (file)
index 0000000..84fc940
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/adaptor-framework/thread-settings.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/thread/common/thread-settings-impl.h>
+
+namespace Dali
+{
+void SetThreadName(const std::string& threadName)
+{
+  Internal::Adaptor::ThreadSettings::SetThreadName( threadName );
+}
+} // namespace Dali
diff --git a/dali/devel-api/adaptor-framework/thread-settings.h b/dali/devel-api/adaptor-framework/thread-settings.h
new file mode 100755 (executable)
index 0000000..78c63a0
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef DALI_THREAD_SETTINGS_H
+#define DALI_THREAD_SETTINGS_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
+// EXTERNAL INCLUDES
+#include <string>
+
+namespace Dali
+{
+/**
+ * @brief Set the thread name.
+ *
+ * @param [in] threadName The name of thread. The name can be up to 16 bytes long, and should be null-terminated if it contains fewer bytes.
+ */
+DALI_ADAPTOR_API void SetThreadName(const std::string& threadName);
+
+} // Dali
+
+#endif // DALI_THREAD_SETTINGS_H
\ No newline at end of file
index 4fc75065d25738acf7957fb24ae5d5a39491971e..db0601d4fb3db7a93bce7f06230462947ac7cded 100755 (executable)
@@ -26,7 +26,9 @@ devel_api_src_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/tilt-sensor.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/lifecycle-controller.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/video-player.cpp \
-  $(adaptor_devel_api_dir)/adaptor-framework/virtual-keyboard.cpp
+  $(adaptor_devel_api_dir)/adaptor-framework/virtual-keyboard.cpp \
+  $(adaptor_devel_api_dir)/adaptor-framework/thread-settings.cpp
+
 
 
 devel_api_adaptor_framework_header_files = \
@@ -63,7 +65,8 @@ devel_api_adaptor_framework_header_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/key-extension-plugin.h \
   $(adaptor_devel_api_dir)/adaptor-framework/virtual-keyboard.h \
   $(adaptor_devel_api_dir)/adaptor-framework/physical-keyboard.h \
-  $(adaptor_devel_api_dir)/adaptor-framework/key-devel.h
+  $(adaptor_devel_api_dir)/adaptor-framework/key-devel.h \
+  $(adaptor_devel_api_dir)/adaptor-framework/thread-settings.h
 
 devel_api_text_abstraction_src_files = \
    $(adaptor_devel_api_dir)/text-abstraction/bidirectional-support.cpp \
index eb5939951b67180620edc4fd16e250bc8c7b148b..72aa9da0b5c846ffedd82dde016fee5fa6fe6147 100644 (file)
@@ -28,6 +28,7 @@
 #include <dali/internal/system/common/environment-options.h>
 #include <dali/internal/system/common/time-service.h>
 #include <dali/internal/adaptor/common/adaptor-internal-services.h>
+#include <dali/devel-api/adaptor-framework/thread-settings.h>
 
 namespace Dali
 {
@@ -374,6 +375,8 @@ void CombinedUpdateRenderController::ProcessSleepRequest()
 
 void CombinedUpdateRenderController::UpdateRenderThread()
 {
+  SetThreadName("RenderThread\0");
+
   // Install a function for logging
   mEnvironmentOptions.InstallLogFunction();
 
diff --git a/dali/internal/thread/common/thread-settings-impl.cpp b/dali/internal/thread/common/thread-settings-impl.cpp
new file mode 100644 (file)
index 0000000..849cb4d
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/thread/common/thread-settings-impl.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace ThreadSettings
+{
+
+void SetThreadName(const std::string& threadName)
+{
+  int err = prctl(PR_SET_NAME, threadName.c_str());
+  if ( err )
+  {
+    DALI_LOG_ERROR( "prctl(PR_SET_NAME, %s) failed\n", threadName.c_str() );
+  }
+}
+
+} // namespace ThreadSettings
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/thread/common/thread-settings-impl.h b/dali/internal/thread/common/thread-settings-impl.h
new file mode 100644 (file)
index 0000000..2766982
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef __DALI_INTERNAL_THREAD_SETTINGS_H__
+#define __DALI_INTERNAL_THREAD_SETTINGS_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <sys/prctl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Implementation of the Thread Settings
+ */
+namespace ThreadSettings
+{
+
+/**
+ * @brief Set the thread name.
+ *
+ * @param [in] threadName The name of thread. The name can be up to 16 bytes long, and should be null-terminated if it contains fewer bytes.
+ */
+void SetThreadName(const std::string& threadName);
+
+} // namespace ThreadSettings
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_THREAD_SETTINGS_H__
diff --git a/dali/internal/thread/file.list b/dali/internal/thread/file.list
new file mode 100644 (file)
index 0000000..7daaf03
--- /dev/null
@@ -0,0 +1,4 @@
+# module: trace, backend: common
+adaptor_thread_common_src_files=\
+    ${adaptor_thread_dir}/common/thread-settings-impl.cpp
+