Merge "Trace use scope macro instead of begin-end" into devel/master
authorEunki Hong <eunkiki.hong@samsung.com>
Fri, 30 Dec 2022 08:22:16 +0000 (08:22 +0000)
committerGerrit Code Review <gerrit@review>
Fri, 30 Dec 2022 08:22:16 +0000 (08:22 +0000)
27 files changed:
build/tizen/profiles/android-profile.cmake
build/tizen/profiles/common-profile.cmake
build/tizen/profiles/glib-x11-profile.cmake
build/tizen/profiles/ivi-profile.cmake
build/tizen/profiles/libuv-x11-profile.cmake
build/tizen/profiles/macos-profile.cmake
build/tizen/profiles/mobile-profile.cmake
build/tizen/profiles/tv-profile.cmake
build/tizen/profiles/ubuntu-profile.cmake
build/tizen/profiles/wearable-profile.cmake
build/tizen/profiles/windows-profile.cmake
dali/devel-api/adaptor-framework/application-devel.cpp
dali/devel-api/adaptor-framework/application-devel.h
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/application-impl.cpp
dali/internal/adaptor/common/application-impl.h
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/adaptor/common/combined-update-render-controller.h
dali/internal/adaptor/common/thread-controller-interface.h
dali/internal/system/common/thread-controller.cpp
dali/internal/system/common/thread-controller.h
dali/internal/thread/common/thread-settings-impl.cpp
dali/internal/thread/common/thread-settings-impl.h
dali/internal/thread/file.list
dali/internal/thread/linux/thread-settings-impl-linux.cpp [new file with mode: 0644]
dali/internal/thread/windows/thread-settings-impl-win.cpp [new file with mode: 0644]

index 5501ba7..36b45e0 100644 (file)
@@ -44,6 +44,7 @@ SET( SOURCES
         ${adaptor_window_system_android_src_files}
         ${adaptor_trace_common_src_files}
         ${adaptor_thread_common_src_files}
+        ${adaptor_thread_linux_src_files}
         ${devel_api_text_abstraction_src_files}
         ${static_libraries_libunibreak_src_files}
         ${adaptor_addons_common_src_files}
index 14b574c..8959963 100644 (file)
@@ -45,6 +45,7 @@ SET( SOURCES
     ${adaptor_window_system_tizen_wayland_src_files}
     ${adaptor_trace_common_src_files}
     ${adaptor_thread_common_src_files}
+    ${adaptor_thread_linux_src_files}
     ${adaptor_addons_common_src_files}
     ${adaptor_addons_tizen_src_files}
     ${devel_api_text_abstraction_src_files}
index 7914fb0..7a45b3d 100644 (file)
@@ -36,6 +36,7 @@ SET( SOURCES
         ${adaptor_resampler_src_files}
         ${adaptor_text_common_src_files}
         ${adaptor_thread_common_src_files}
+        ${adaptor_thread_linux_src_files}
         ${adaptor_trace_common_src_files}
         ${adaptor_vector_animation_common_src_files}
         ${adaptor_vector_image_common_src_files}
index 268e690..86bc9f2 100644 (file)
@@ -46,6 +46,7 @@ SET( SOURCES
      ${adaptor_window_system_tizen_wayland_src_files}
      ${adaptor_trace_common_src_files}
      ${adaptor_thread_common_src_files}
+     ${adaptor_thread_linux_src_files}
      ${adaptor_addons_common_src_files}
      ${adaptor_addons_tizen_src_files}
      ${devel_api_text_abstraction_src_files}
index 91b237e..8b8e5d0 100644 (file)
@@ -36,6 +36,7 @@ SET( SOURCES
         ${adaptor_resampler_src_files}
         ${adaptor_text_common_src_files}
         ${adaptor_thread_common_src_files}
+        ${adaptor_thread_linux_src_files}
         ${adaptor_trace_common_src_files}
         ${adaptor_vector_animation_common_src_files}
         ${adaptor_vector_image_common_src_files}
index e247819..8111ce5 100644 (file)
@@ -44,6 +44,7 @@ SET( SOURCES
         ${adaptor_macos_platform_src_files}
         ${adaptor_trace_common_src_files}
         ${adaptor_thread_common_src_files}
+        ${adaptor_thread_linux_src_files}
         ${adaptor_window_system_macos_src_files}
         ${devel_api_text_abstraction_src_files}
         ${adaptor_addons_common_src_files}
index 05e453d..3b1d651 100644 (file)
@@ -45,6 +45,7 @@ SET( SOURCES
         ${adaptor_window_system_tizen_wayland_src_files}
         ${adaptor_trace_common_src_files}
         ${adaptor_thread_common_src_files}
+        ${adaptor_thread_linux_src_files}
         ${adaptor_addons_common_src_files}
         ${adaptor_addons_tizen_src_files}
         ${devel_api_text_abstraction_src_files}
index b3c17bb..8305c24 100644 (file)
@@ -45,6 +45,7 @@ SET( SOURCES
     ${adaptor_window_system_tizen_wayland_src_files}
     ${adaptor_trace_common_src_files}
     ${adaptor_thread_common_src_files}
+    ${adaptor_thread_linux_src_files}
     ${devel_api_text_abstraction_src_files}
     ${adaptor_addons_common_src_files}
     ${adaptor_addons_tizen_src_files}
index 79dd1a7..2429239 100644 (file)
@@ -43,6 +43,7 @@ SET( SOURCES
         ${adaptor_window_system_common_src_files}
         ${adaptor_trace_common_src_files}
         ${adaptor_thread_common_src_files}
+        ${adaptor_thread_linux_src_files}
         ${adaptor_window_system_ubuntu_x11_src_files}
         ${devel_api_text_abstraction_src_files}
         ${adaptor_addons_common_src_files}
index f0211db..ee6060c 100644 (file)
@@ -47,6 +47,7 @@ SET( SOURCES
     ${adaptor_window_system_tizen_wayland_src_files}
     ${adaptor_trace_common_src_files}
     ${adaptor_thread_common_src_files}
+    ${adaptor_thread_linux_src_files}
     ${adaptor_addons_common_src_files}
     ${adaptor_addons_tizen_src_files}
     ${devel_api_text_abstraction_src_files}
index 7a03885..3ab536f 100644 (file)
@@ -35,6 +35,7 @@ SET( SOURCES
         ${adaptor_window_system_common_src_files}
         ${adaptor_trace_common_src_files}
         ${adaptor_thread_common_src_files}
+        ${adaptor_thread_windows_src_files}
         ${devel_api_text_abstraction_src_files}
         ${static_libraries_libunibreak_src_files}
         ${adaptor_windows_platform_src_files}
index 8ce55e2..18a233c 100644 (file)
@@ -46,7 +46,8 @@ Application New(int* argc, char** argv[], const std::string& stylesheet, Applica
 
     //Store only the value before adaptor is created
     internal->StoreWindowPositionSize(positionSize);
-  } else
+  }
+  else
   {
     internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL, type, false);
   }
@@ -79,6 +80,11 @@ CustomCommandReceivedSignalType& CustomCommandReceivedSignal(Application applica
   return networkService->CustomCommandReceivedSignal();
 }
 
+int32_t GetRenderThreadId(Application application)
+{
+  return Internal::Adaptor::GetImplementation(application).GetRenderThreadId();
+}
+
 } // namespace DevelApplication
 
 } // namespace Dali
index 095c252..19c96d5 100644 (file)
@@ -29,7 +29,6 @@ namespace Dali
 {
 namespace DevelApplication
 {
-
 using CustomCommandReceivedSignalType = Signal<void(const std::string&)>; ///< Signal signature for CustomCommandReceivedSignal
 
 /**
@@ -99,6 +98,14 @@ DALI_ADAPTOR_API Application DownCast(Dali::RefObject* refObject);
  */
 DALI_ADAPTOR_API CustomCommandReceivedSignalType& CustomCommandReceivedSignal(Application application);
 
+/**
+ * @brief Gets the render thread id of DALi.
+ * @note If render thread id getter doesn't supported, it will return 0 as default.
+ * @param application A handle to the Application
+ * @return The render thread id.
+ */
+DALI_ADAPTOR_API int32_t GetRenderThreadId(Application application);
+
 } // namespace DevelApplication
 
 } // namespace Dali
index 1ab6e70..42b9309 100644 (file)
@@ -1140,6 +1140,15 @@ bool Adaptor::IsMultipleWindowSupported() const
   return mConfigurationManager->IsMultipleWindowSupported();
 }
 
+int32_t Adaptor::GetRenderThreadId() const
+{
+  if(mThreadController)
+  {
+    return mThreadController->GetThreadId();
+  }
+  return 0;
+}
+
 void Adaptor::RequestUpdateOnce()
 {
   if(mThreadController)
index d24b830..07f5df4 100644 (file)
@@ -456,6 +456,13 @@ public:
    */
   bool IsMultipleWindowSupported() const;
 
+  /**
+   * @brief Gets the render thread id of DALi.
+   * @note If render thread id getter doesn't supported, it will return 0 as default.
+   * @return The render thread id.
+   */
+  int32_t GetRenderThreadId() const;
+
 public: //AdaptorInternalServices
   /**
    * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetPlatformAbstractionInterface()
index c44318e..e7d2687 100644 (file)
@@ -529,6 +529,15 @@ void Application::SetDefaultWindowType(WindowType type)
   mMainWindow.SetType(type);
 }
 
+int32_t Application::GetRenderThreadId() const
+{
+  if(mAdaptor)
+  {
+    return Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).GetRenderThreadId();
+  }
+  return 0;
+}
+
 ApplicationPtr Application::GetPreInitializedApplication()
 {
   // Reset the handle to decrease the reference count
index 2b2e872..8e334a7 100644 (file)
@@ -160,6 +160,11 @@ public:
    */
   void StoreWindowPositionSize(PositionSize positionSize);
 
+  /**
+   * @copydoc Dali::DevelApplication::GetRenderThreadId()
+   */
+  int32_t GetRenderThreadId() const;
+
 public: // From Framework::Observer
   /**
    * Called when the framework is initialised.
index d32f881..53514de 100644 (file)
@@ -25,7 +25,6 @@
 #include "dali/public-api/common/dali-common.h"
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/thread-settings.h>
 #include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
 #include <dali/internal/adaptor/common/adaptor-internal-services.h>
 #include <dali/internal/adaptor/common/combined-update-render-controller-debug.h>
@@ -33,6 +32,7 @@
 #include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/system/common/environment-options.h>
 #include <dali/internal/system/common/time-service.h>
+#include <dali/internal/thread/common/thread-settings-impl.h>
 #include <dali/internal/window-system/common/window-impl.h>
 
 namespace Dali
@@ -105,6 +105,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController(AdaptorInternalSe
   mDefaultHalfFrameNanoseconds(0u),
   mUpdateRequestCount(0u),
   mRunning(FALSE),
+  mThreadId(0),
   mThreadMode(threadMode),
   mUpdateRenderRunCount(0),
   mDestroyUpdateRenderThread(FALSE),
@@ -407,6 +408,11 @@ void CombinedUpdateRenderController::AddSurface(Dali::RenderSurfaceInterface* su
   }
 }
 
+int32_t CombinedUpdateRenderController::GetThreadId() const
+{
+  return mThreadId;
+}
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // EVENT THREAD
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -497,7 +503,8 @@ void CombinedUpdateRenderController::ProcessSleepRequest()
 
 void CombinedUpdateRenderController::UpdateRenderThread()
 {
-  SetThreadName("RenderThread\0");
+  ThreadSettings::SetThreadName("RenderThread\0");
+  mThreadId = ThreadSettings::GetThreadId();
 
   // Install a function for logging
   mEnvironmentOptions.InstallLogFunction();
index 7127d66..8902875 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -154,6 +154,11 @@ public:
    */
   void AddSurface(Dali::RenderSurfaceInterface* surface) override;
 
+  /**
+   * @copydoc ThreadControllerInterface::GetThreadId()
+   */
+  int32_t GetThreadId() const override;
+
 private:
   // Undefined copy constructor.
   CombinedUpdateRenderController(const CombinedUpdateRenderController&);
@@ -352,8 +357,9 @@ private:
   uint64_t mDefaultFrameDurationNanoseconds;  ///< Default duration of a frame (used for sleeping if not enough time elapsed). Not protected by lock, but written to rarely so not worth adding a lock when reading.
   uint64_t mDefaultHalfFrameNanoseconds;      ///< Is half of mDefaultFrameDurationNanoseconds. Using a member variable avoids having to do the calculation every frame. Not protected by lock, but written to rarely so not worth adding a lock when reading.
 
-  unsigned int mUpdateRequestCount; ///< Count of update-requests we have received to ensure we do not go to sleep too early.
-  unsigned int mRunning;            ///< Read and set on the event-thread only to state whether we are running.
+  uint32_t mUpdateRequestCount; ///< Count of update-requests we have received to ensure we do not go to sleep too early.
+  uint32_t mRunning;            ///< Read and set on the event-thread only to state whether we are running.
+  int32_t  mThreadId;           ///< UpdateRender thread id
 
   ThreadMode mThreadMode; ///< Whether the thread runs continuously or runs when it is requested.
 
index 1ab348a..7d81c1f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -18,7 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
 #include <dali/public-api/signals/callback.h>
+#include <stdint.h>
 
 namespace Dali
 {
@@ -129,6 +131,12 @@ public:
    */
   virtual void AddSurface(Dali::RenderSurfaceInterface* surface) = 0;
 
+  /**
+   * @brief Gets the thread id.
+   * @return The thread id.
+   */
+  virtual int32_t GetThreadId() const = 0;
+
 protected:
   /**
    * Constructor
index 54633bd..b3874d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -117,6 +117,11 @@ void ThreadController::AddSurface(Dali::RenderSurfaceInterface* newSurface)
   mThreadControllerInterface->AddSurface(newSurface);
 }
 
+int32_t ThreadController::GetThreadId() const
+{
+  return mThreadControllerInterface->GetThreadId();
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index ba58948..5f22a6a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_THREAD_CONTROLLER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -141,6 +141,13 @@ public:
    */
   void AddSurface(Dali::RenderSurfaceInterface* surface);
 
+  /**
+   * @brief Gets the thread id.
+   * @note If thread id getter doesn't supported, it will return 0 as default.
+   * @return The thread id.
+   */
+  int32_t GetThreadId() const;
+
 private:
   // Undefined copy constructor.
   ThreadController(const ThreadController&) = delete;
index aa0616e..bf898a0 100644 (file)
@@ -18,6 +18,9 @@
 // CLASS HEADER
 #include <dali/internal/thread/common/thread-settings-impl.h>
 
+// EXTERNAL INCLUDES
+#include <sys/prctl.h>
+
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
index b091736..addad67 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_THREAD_SETTINGS_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -19,7 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <sys/prctl.h>
 #include <string>
 
 namespace Dali
@@ -40,6 +39,13 @@ namespace ThreadSettings
  */
 void SetThreadName(const std::string& threadName);
 
+/**
+ * @brief Get the thread id.
+ * @note If thread id getter doesn't supported, it will return 0 as default.
+ * @return The thread id.
+ */
+int32_t GetThreadId();
+
 } // namespace ThreadSettings
 
 } // namespace Adaptor
index 4cc599c..1e17e06 100644 (file)
@@ -1,6 +1,15 @@
-
-# module: trace, backend: common
-SET( adaptor_thread_common_src_files 
+# module: thread, backend: common
+SET( adaptor_thread_common_src_files
     ${adaptor_thread_dir}/common/thread-settings-impl.cpp
 )
 
+# module: thread, backend: linux
+SET( adaptor_thread_linux_src_files
+    ${adaptor_thread_dir}/linux/thread-settings-impl-linux.cpp
+)
+
+# module: thread, backend: windows
+SET( adaptor_thread_windows_src_files
+    ${adaptor_thread_dir}/windows/thread-settings-impl-win.cpp
+)
+
diff --git a/dali/internal/thread/linux/thread-settings-impl-linux.cpp b/dali/internal/thread/linux/thread-settings-impl-linux.cpp
new file mode 100644 (file)
index 0000000..2bb8ec2
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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>
+
+// EXTERNAL INCLUDES
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace ThreadSettings
+{
+int32_t GetThreadId()
+{
+  return static_cast<int>(syscall(SYS_gettid));
+}
+
+} // namespace ThreadSettings
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/thread/windows/thread-settings-impl-win.cpp b/dali/internal/thread/windows/thread-settings-impl-win.cpp
new file mode 100644 (file)
index 0000000..7e67307
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace ThreadSettings
+{
+int32_t GetThreadId()
+{
+  // TODO: Need to implement
+  return 0;
+}
+
+} // namespace ThreadSettings
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali