Added Trace Functionality using Performance Server. 78/170978/19
authorUmar <m.umar@partner.samsung.com>
Fri, 23 Feb 2018 20:21:44 +0000 (20:21 +0000)
committerUmar <m.umar@partner.samsung.com>
Thu, 5 Apr 2018 13:59:47 +0000 (14:59 +0100)
Change-Id: I7e773f399c754afbc60c7cabffa036a0628bbcfe

22 files changed:
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.h
build/tizen/adaptor/Makefile.am
build/tizen/adaptor/configure.ac
build/tizen/adaptor/module.list
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/system/common/environment-options.cpp
dali/internal/system/common/environment-options.h
dali/internal/trace/common/trace-factory.cpp [new file with mode: 0644]
dali/internal/trace/common/trace-factory.h [new file with mode: 0644]
dali/internal/trace/common/trace-manager-impl.cpp [new file with mode: 0644]
dali/internal/trace/common/trace-manager-impl.h [new file with mode: 0644]
dali/internal/trace/file.list [new file with mode: 0644]
dali/internal/trace/tizen/trace-factory-tizen.cpp [new file with mode: 0644]
dali/internal/trace/tizen/trace-manager-impl-tizen.cpp [new file with mode: 0644]
dali/internal/trace/tizen/trace-manager-impl-tizen.h [new file with mode: 0644]
dali/internal/trace/ubuntu/trace-factory-ubuntu.cpp [new file with mode: 0644]
dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.cpp [new file with mode: 0644]
dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.h [new file with mode: 0644]
packaging/dali-adaptor.spec

index 0e640e7f3470824eea9d34e9df9cba063332b5f9..8bb7176a0f5aca266910af7a9160ce203dbb4c7a 100644 (file)
@@ -79,6 +79,11 @@ void TestApplication::Initialize()
   Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
   Dali::Integration::Log::InstallLogFunction(logFunction);
 
+  Dali::Integration::Trace::LogContextFunction logContextFunction(&TestApplication::LogContext);
+  Dali::Integration::Trace::InstallLogContextFunction( logContextFunction );
+
+  Dali::Integration::Trace::LogContext( true, "Test" );
+
   mCore->SceneCreated();
 }
 
@@ -88,6 +93,18 @@ TestApplication::~TestApplication()
   delete mCore;
 }
 
+void TestApplication::LogContext( bool start, const char* tag )
+{
+  if( start )
+  {
+    fprintf(stderr, "INFO: Trace Start: %s", tag);
+  }
+  else
+  {
+    fprintf(stderr, "INFO: Trace End: %s", tag);
+  }
+}
+
 void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message)
 {
   switch(level)
index 5c942524cff94429208e7f148f65124770924802..747b488cad75535877ddf3b8f31f236aa6bc679a 100644 (file)
@@ -26,6 +26,7 @@
 #include "test-render-controller.h"
 #include <dali/public-api/common/dali-common.h>
 #include <dali/integration-api/resource-policies.h>
+#include <dali/integration-api/trace.h>
 
 namespace Dali
 {
@@ -66,6 +67,7 @@ public:
   void Initialize();
   virtual ~TestApplication();
   static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message );
+  static void LogContext( bool start, const char* tag );
   Dali::Integration::Core& GetCore();
   TestPlatformAbstraction& GetPlatform();
   TestRenderController& GetRenderController();
index f5171f16794ea7afcf324e6052a07e567e67cc8a..b5911e55c572ed7d6f8e622a340cbb16ccc9c457 100644 (file)
@@ -65,6 +65,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_resampler_src_files) \
                   $(adaptor_video_common_src_files) \
                   $(adaptor_window_system_common_src_files) \
+                  $(adaptor_trace_common_src_files) \
                   $(adaptor_window_system_ubuntu_x11_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
@@ -75,6 +76,11 @@ LIBDALI_ADAPTOR_LA_SOURCES += \
                   $(adaptor_performance_logging_src_files)
 endif
 
+if ENABLE_TRACE
+LIBDALI_ADAPTOR_LA_SOURCES += \
+                  $(adaptor_trace_ubuntu_src_files)
+endif
+
 endif
 
 
@@ -112,6 +118,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_tizen_mobile_src_files) \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
+                  $(adaptor_trace_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -121,6 +128,11 @@ LIBDALI_ADAPTOR_LA_SOURCES += \
                   $(adaptor_performance_logging_src_files)
 endif
 
+if ENABLE_TRACE
+LIBDALI_ADAPTOR_LA_SOURCES += \
+                  $(adaptor_trace_tizen_src_files)
+endif
+
 endif
 
 
@@ -158,6 +170,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_common_src_files) \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
+                  $(adaptor_trace_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -167,6 +180,11 @@ LIBDALI_ADAPTOR_LA_SOURCES += \
                   $(adaptor_performance_logging_src_files)
 endif
 
+if ENABLE_TRACE
+LIBDALI_ADAPTOR_LA_SOURCES += \
+                  $(adaptor_trace_tizen_src_files)
+endif
+
 endif
 
 
@@ -203,6 +221,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_common_src_files) \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
+                  $(adaptor_trace_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -212,6 +231,11 @@ LIBDALI_ADAPTOR_LA_SOURCES += \
                   $(adaptor_performance_logging_src_files)
 endif
 
+if ENABLE_TRACE
+LIBDALI_ADAPTOR_LA_SOURCES += \
+                  $(adaptor_trace_tizen_src_files)
+endif
+
 endif
 
 if COMMON_PROFILE
@@ -247,6 +271,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_common_src_files) \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
+                  $(adaptor_trace_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -256,6 +281,11 @@ LIBDALI_ADAPTOR_LA_SOURCES += \
                   $(adaptor_performance_logging_src_files)
 endif
 
+if ENABLE_TRACE
+LIBDALI_ADAPTOR_LA_SOURCES += \
+                  $(adaptor_trace_tizen_src_files)
+endif
+
 endif
 
 
@@ -295,6 +325,7 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
                   $(adaptor_window_system_tizen_wearable_src_files) \
+                  $(adaptor_trace_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
                   $(static_libraries_libunibreak_src_files)
@@ -304,6 +335,11 @@ LIBDALI_ADAPTOR_LA_SOURCES += \
                   $(adaptor_performance_logging_src_files)
 endif
 
+if ENABLE_TRACE
+LIBDALI_ADAPTOR_LA_SOURCES += \
+                  $(adaptor_trace_tizen_src_files)
+endif
+
 endif
 
 
index cb48b5f5ef1848875b4e04293e220fb13f5a39fe..6cff84b468646b788378fffd631cf7e028e15635 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2017 Samsung Electronics Co., Ltd.
+# 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.
@@ -111,6 +111,10 @@ if test "x$enable_debug" = "xyes"; then
   DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DDEBUG_ENABLED"
 fi
 
+if test "x$enable_trace" = "xyes"; then
+  DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DTRACE_ENABLED"
+fi
+
 if test "x$enable_debug" = "xno" -a "x$enable_exportall" = "xno"; then
   DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
 fi
@@ -207,6 +211,8 @@ AM_CONDITIONAL([ENABLE_VECTOR_BASED_TEXT_RENDERING], [test x$enable_profile = xU
 
 AM_CONDITIONAL([ENABLE_NETWORK_LOGGING], [test x$enable_networklogging = xyes])
 
+AM_CONDITIONAL([ENABLE_TRACE], [test x$enable_trace = xyes])
+
 # Platforms should either enable features or remove them, they
 # should not disable features. This allows the developer to override
 # features through the command line.
@@ -368,6 +374,7 @@ Configuration
 -------------
   Prefix:                           $prefix
   Debug Build:                      $enable_debug
+  Trace Build:                      $enable_trace
   Compile flags:                    $DALI_ADAPTOR_CFLAGS
   Freetype bitmap support (Emoji):  $freetype_bitmap_support
   Profile:                          $enable_profile
index 0478c3cd1729d997c2e946f54a0ba694c983124a..a326b6e64edb2262a86478381452cb49864922f3 100644 (file)
@@ -59,6 +59,10 @@ include ../../../dali/internal/video/file.list
 adaptor_window_system_dir = ../../../dali/internal/window-system
 include ../../../dali/internal/window-system/file.list
 
+# Module: trace
+adaptor_trace_dir = ../../../dali/internal/trace
+include ../../../dali/internal/trace/file.list
+
 # Module: public-api
 adaptor_public_api_dir = ../../../dali/public-api
 include ../../../dali/public-api/file.list
index fcf972460d6534c0272bf5b6c6f96229cdc88bf6..9d8adc1a474c1ca10b6b0f626ac1ffad0997f73b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
@@ -123,6 +123,9 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
     mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
   }
 
+  mEnvironmentOptions->CreateTraceManager( mPerformanceInterface );
+  mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
+
   mCallbackManager = CallbackManager::New();
 
   PositionSize size = mSurface->GetPositionSize();
index c544383c5fe6cb8dc57ff927a010348b9da29ef6..27508e6d51e522c6f567ad7050d75c29ae1d941f 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_ADAPTOR_IMPL_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
index 31cf0fd49e7ea3f5c59e0a6a802a2a0e5c4bbcc5..5af0ca1a46f9f3b134c36e2aad82c3e827638e3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
@@ -40,6 +40,7 @@ namespace Adaptor
 
 namespace
 {
+
 const unsigned int CREATED_THREAD_COUNT = 1u;
 
 const int CONTINUOUS = -1;
@@ -382,6 +383,9 @@ void CombinedUpdateRenderController::UpdateRenderThread()
   // Install a function for logging
   mEnvironmentOptions.InstallLogFunction();
 
+  // Install a function for tracing
+  mEnvironmentOptions.InstallTraceFunction();
+
   LOG_UPDATE_RENDER( "THREAD CREATED" );
 
   mRenderHelper.InitializeEgl();
index 9e92fa72608a8441ef5f71d23ff8e1869df0ade3..31a8dc6afcaf70687a66228990764a42830d54c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
@@ -24,6 +24,7 @@
 #include <dali/public-api/math/math-utils.h>
 
 // INTERNAL INCLUDES
+#include <dali/internal/trace/common/trace-factory.h>
 #include <dali/internal/system/common/environment-variables.h>
 
 namespace Dali
@@ -133,6 +134,19 @@ EnvironmentOptions::~EnvironmentOptions()
 {
 }
 
+void EnvironmentOptions::CreateTraceManager( PerformanceInterface* performanceInterface )
+{
+  mTraceManager = TraceManagerFactory::CreateTraceFactory( performanceInterface );
+}
+
+void EnvironmentOptions::InstallTraceFunction() const
+{
+  if( mTraceManager )
+  {
+    mTraceManager->Initialise();
+  }
+}
+
 void EnvironmentOptions::SetLogFunction( const Dali::Integration::Log::LogFunction& logFunction )
 {
   mLogFunction = logFunction;
index 3daf7d19887943ab7811b1ff3826ca1e07c56c40..77d5c62dcccfb7b7bd0475650739a40f485a91d2 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <memory>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -31,6 +32,8 @@ namespace Internal
 {
 namespace Adaptor
 {
+class TraceManager;
+class PerformanceInterface;
 
 /**
  * This class provides the environment options which define settings as well as
@@ -51,6 +54,17 @@ public:
    */
   virtual ~EnvironmentOptions();
 
+  /**
+   * Create a TraceManager which is used for tracing.
+   * @param PerformanceInterface for using network logging for tracing on Ubuntu
+   */
+  void CreateTraceManager( PerformanceInterface* performanceInterface );
+
+  /**
+   * Initialize TraceManager by installing Trace function.
+   */
+  void InstallTraceFunction() const;
+
   /**
    * @param logFunction logging function
    */
@@ -300,7 +314,6 @@ private: // Internal
 private: // Data
 
   Dali::Integration::Log::LogFunction mLogFunction;
-
   std::string mWindowName;                        ///< name of the window
   std::string mWindowClassName;                   ///< name of the class the window belongs to
   unsigned int mNetworkControl;                   ///< whether network control is enabled
@@ -340,6 +353,7 @@ private: // Data
   bool mGlesCallAccumulate;                       ///< Whether or not to accumulate gles call statistics
   bool mDepthBufferRequired;                      ///< Whether the depth buffer is required
   bool mStencilBufferRequired;                    ///< Whether the stencil buffer is required
+  std::unique_ptr<TraceManager> mTraceManager;    ///< TraceManager
 };
 
 } // Adaptor
diff --git a/dali/internal/trace/common/trace-factory.cpp b/dali/internal/trace/common/trace-factory.cpp
new file mode 100644 (file)
index 0000000..c7d15f7
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ *
+ */
+
+#include <dali/internal/trace/common/trace-factory.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace TraceManagerFactory
+{
+
+// Factory function creating new TraceFactory
+// Symbol exists but may be overriden during linking
+
+__attribute__((weak))
+TraceManagerUPtr CreateTraceFactory( PerformanceInterface* performanceInterface )
+{
+  // return empty handle if TraceManager not implemented
+  return nullptr;
+}
+
+} // namespace TraceManagerFactory
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
\ No newline at end of file
diff --git a/dali/internal/trace/common/trace-factory.h b/dali/internal/trace/common/trace-factory.h
new file mode 100644 (file)
index 0000000..5f1cfb9
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef DALI_INTERNAL_TRACE_FACTORY_H
+#define DALI_INTERNAL_TRACE_FACTORY_H
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <memory>
+
+// INTERNAL INCLUDES
+#include <dali/internal/trace/common/trace-manager-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace TraceManagerFactory
+{
+
+using TraceManagerUPtr = std::unique_ptr<TraceManager>;
+
+// Factory function creating new TraceFactory
+// Symbol exists but may be overriden during linking
+TraceManagerUPtr CreateTraceFactory( PerformanceInterface* performanceInterface );
+
+} // namespace TraceManagerFactory
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif //DALI_INTERNAL_TRACE_FACTORY_H
diff --git a/dali/internal/trace/common/trace-manager-impl.cpp b/dali/internal/trace/common/trace-manager-impl.cpp
new file mode 100644 (file)
index 0000000..8a34c2f
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/internal/trace/common/trace-manager-impl.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+TraceManager::TraceManager( PerformanceInterface* performanceInterface )
+: mPerformanceInterface( performanceInterface )
+{
+}
+
+bool TraceManager::Initialise()
+{
+  auto logFunction = GetLogContextFunction();
+  if( !logFunction )
+  {
+      return false;
+  }
+  Dali::Integration::Trace::InstallLogContextFunction( logFunction );
+  return true;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/trace/common/trace-manager-impl.h b/dali/internal/trace/common/trace-manager-impl.h
new file mode 100644 (file)
index 0000000..7bbb6cc
--- /dev/null
@@ -0,0 +1,91 @@
+#ifndef DALI_INTERNAL_TRACE_MANAGER_IMPL_H
+#define DALI_INTERNAL_TRACE_MANAGER_IMPL_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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/trace.h>
+
+// INTERNAL INCLUDES
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+class PerformanceInterface;
+
+class TraceManager
+{
+public:
+
+  /**
+   * Explicit Constructor
+   */
+  explicit TraceManager( PerformanceInterface* performanceInterface );
+
+  /**
+   * Constructor
+   */
+  TraceManager() = default;
+
+  /**
+   * Virtual Destructor
+   */
+  virtual ~TraceManager() = default;
+
+  /**
+   * Second phase initialisation of TraceManager
+   */
+  bool Initialise();
+
+  /**
+   * Used for network server logging on Ubuntu
+   */
+  PerformanceInterface* mPerformanceInterface;
+
+protected:
+
+  /**
+   * Obtain the platform dependent LogContextFunction method used for tracing
+   */
+  virtual Dali::Integration::Trace::LogContextFunction GetLogContextFunction() { return nullptr; };
+
+private:
+
+  /**
+   * Set / Install the platform dependent trace function
+   * @param logContextFunction - Platform dependent trace function
+   */
+  void SetTraceLogContextFunction( const Dali::Integration::Trace::LogContextFunction& logContextFunction );
+
+  TraceManager( const TraceManager& ) = delete;
+  TraceManager& operator=( TraceManager& )  = delete;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_TRACE_MANAGER_IMPL_H
diff --git a/dali/internal/trace/file.list b/dali/internal/trace/file.list
new file mode 100644 (file)
index 0000000..9b94bd6
--- /dev/null
@@ -0,0 +1,16 @@
+
+
+# module: trace, backend: common
+adaptor_trace_common_src_files=\
+    ${adaptor_trace_dir}/common/trace-manager-impl.cpp \
+    ${adaptor_trace_dir}/common/trace-factory.cpp
+
+# module: trace, backend: ubuntu
+adaptor_trace_ubuntu_src_files=\
+    ${adaptor_trace_dir}/ubuntu/trace-manager-impl-ubuntu.cpp \
+    ${adaptor_trace_dir}/ubuntu/trace-factory-ubuntu.cpp
+
+# module: trace, backend: tizen
+adaptor_trace_tizen_src_files=\
+    ${adaptor_trace_dir}/tizen/trace-manager-impl-tizen.cpp \
+    ${adaptor_trace_dir}/tizen/trace-factory-tizen.cpp
\ No newline at end of file
diff --git a/dali/internal/trace/tizen/trace-factory-tizen.cpp b/dali/internal/trace/tizen/trace-factory-tizen.cpp
new file mode 100644 (file)
index 0000000..51715ba
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ */
+
+#include <dali/internal/trace/common/trace-factory.h>
+#include <dali/internal/trace/tizen/trace-manager-impl-tizen.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace TraceManagerFactory
+{
+
+// TraceManager Factory to be implemented by the platform
+TraceManagerUPtr CreateTraceFactory( PerformanceInterface* performanceInterface )
+{
+  return TraceManagerUPtr( new Dali::Internal::Adaptor::TraceManagerTizen( performanceInterface ) );
+}
+
+} // namespace TraceManagerFactory
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
\ No newline at end of file
diff --git a/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp b/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp
new file mode 100644 (file)
index 0000000..9095bcf
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <ttrace.h>
+#include <dali/internal/trace/tizen/trace-manager-impl-tizen.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+TraceManagerTizen::TraceManagerTizen( PerformanceInterface* performanceInterface )
+: TraceManager( performanceInterface )
+{
+}
+
+Dali::Integration::Trace::LogContextFunction TraceManagerTizen::GetLogContextFunction()
+{
+  return LogContext;
+}
+
+void TraceManagerTizen::LogContext( bool start, const char* tag )
+{
+  if( start )
+  {
+    traceBegin( TTRACE_TAG_GRAPHICS, tag );
+  }
+  else
+  {
+    traceEnd( TTRACE_TAG_GRAPHICS );
+  }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/trace/tizen/trace-manager-impl-tizen.h b/dali/internal/trace/tizen/trace-manager-impl-tizen.h
new file mode 100644 (file)
index 0000000..58432cc
--- /dev/null
@@ -0,0 +1,70 @@
+#ifndef DALI_INTERNAL_TRACE_MANAGER_IMPL_TIZEN_H
+#define DALI_INTERNAL_TRACE_MANAGER_IMPL_TIZEN_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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali/internal/trace/common/trace-manager-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+class PerformanceInterface;
+
+class TraceManagerTizen : public Dali::Internal::Adaptor::TraceManager
+{
+public:
+  /**
+   * Explicit Constructor
+   */
+  explicit TraceManagerTizen( PerformanceInterface* performanceInterface );
+
+protected:
+
+  /**
+   * Destructor
+   */
+  ~TraceManagerTizen() override = default;
+
+  /**
+   * Obtain the LogContextFunction method (Tizen specific) used for tracing
+   */
+  virtual Dali::Integration::Trace::LogContextFunction GetLogContextFunction() final;
+
+private:
+
+  /**
+   * LogContext method (Tizen specific) used for tracing
+   */
+  static void LogContext( bool start, const char* tag );
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_TRACE_MANAGER_IMPL_TIZEN_H
diff --git a/dali/internal/trace/ubuntu/trace-factory-ubuntu.cpp b/dali/internal/trace/ubuntu/trace-factory-ubuntu.cpp
new file mode 100644 (file)
index 0000000..63b2592
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ */
+
+#include <dali/internal/trace/common/trace-factory.h>
+#include <dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace TraceManagerFactory
+{
+
+// TraceManager Factory to be implemented by the platform
+TraceManagerUPtr CreateTraceFactory( PerformanceInterface* performanceInterface )
+{
+  return TraceManagerUPtr( new Dali::Internal::Adaptor::TraceManagerUbuntu( performanceInterface ) );
+}
+
+} // namespace TraceManagerFactory
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
\ No newline at end of file
diff --git a/dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.cpp b/dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.cpp
new file mode 100644 (file)
index 0000000..c172c1a
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.h>
+#include <dali/internal/system/common/performance-interface.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+TraceManagerUbuntu* TraceManagerUbuntu::traceManagerUbuntu = nullptr;
+
+TraceManagerUbuntu::TraceManagerUbuntu( PerformanceInterface* performanceInterface )
+: TraceManager( performanceInterface )
+{
+  TraceManagerUbuntu::traceManagerUbuntu = this;
+}
+
+Dali::Integration::Trace::LogContextFunction TraceManagerUbuntu::GetLogContextFunction()
+{
+  return LogContext;
+}
+
+void TraceManagerUbuntu::LogContext( bool start, const char* tag )
+{
+  if( start )
+  {
+    unsigned short contextId = traceManagerUbuntu->mPerformanceInterface->AddContext( tag );
+    traceManagerUbuntu->mPerformanceInterface->AddMarker( PerformanceInterface::START, contextId );
+  }
+  else
+  {
+    unsigned short contextId = traceManagerUbuntu->mPerformanceInterface->AddContext( tag );
+    traceManagerUbuntu->mPerformanceInterface->AddMarker( PerformanceInterface::END, contextId );
+  }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.h b/dali/internal/trace/ubuntu/trace-manager-impl-ubuntu.h
new file mode 100644 (file)
index 0000000..7590bdf
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef DALI_INTERNAL_TRACE_MANAGER_IMPL_UBUNTU_H
+#define DALI_INTERNAL_TRACE_MANAGER_IMPL_UBUNTU_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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali/internal/trace/common/trace-manager-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+class PerformanceInterface;
+
+class TraceManagerUbuntu : public Dali::Internal::Adaptor::TraceManager
+{
+public:
+  /**
+   * Static member to hold TraceManagerUbuntu instance. This allows
+   * to access PerformanceInterface for network logging.
+   */
+  static TraceManagerUbuntu* traceManagerUbuntu;
+
+  /**
+   * Explicit Constructor
+   */
+  explicit TraceManagerUbuntu( PerformanceInterface* performanceInterface );
+
+protected:
+  /**
+   * Destructor
+   */
+  ~TraceManagerUbuntu() override = default;
+
+  /**
+   * Obtain the LogContextFunction method (Ubuntu specific) used for tracing
+   */
+  virtual Dali::Integration::Trace::LogContextFunction GetLogContextFunction() final;
+
+private:
+
+  /**
+   * LogContext method (Ubuntu specific) used for tracing
+   */
+  static void LogContext( bool start, const char* tag );
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_TRACE_MANAGER_IMPL_UBUNTU_H
index 8f8721f181a7b0b1a4aaf556d4824f521aa937e2..c47540222db378a24070d6ef9657b68324014e0f 100644 (file)
@@ -416,7 +416,7 @@ Feedback plugin to play haptic and audio feedback for Dali
 %build
 PREFIX+="/usr"
 CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections -DGL_GLEXT_PROTOTYPES"
-LDFLAGS+=" -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
+LDFLAGS+=" -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--gc-sections -lttrace -Wl,-Bsymbolic-functions "
 
 %ifarch %{arm}
 CXXFLAGS+=" -D_ARCH_ARM_ -lgcc"
@@ -478,6 +478,9 @@ TIZEN_PLATFORM_CONFIG_SUPPORTED="%{tizen_platform_config_supported}" ; export TI
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -492,7 +495,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.mobile"; done
-for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 mv pkgconfig/dali-adaptor*pc %{_builddir}/%{name}-%{version}/build/tizen/
 popd
 
@@ -520,6 +523,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -534,7 +540,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.tv"; done
-for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 mv pkgconfig/dali-adaptor*pc %{_builddir}/%{name}-%{version}/build/tizen/
 popd
 
@@ -561,6 +567,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -575,7 +584,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.wearable"; done
-for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 mv pkgconfig/dali-adaptor*pc %{_builddir}/%{name}-%{version}/build/tizen/
 popd
 
@@ -602,6 +611,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -616,7 +628,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adaptor*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.ivi"; done
-for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 
 mv pkgconfig/dali-adaptor*pc %{_builddir}/%{name}-%{version}/build/tizen/
 popd
@@ -645,6 +657,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -659,7 +674,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
-for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin*-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 
 mv pkgconfig/dali-adaptor*pc %{_builddir}/%{name}-%{version}/build/tizen/
 popd
@@ -696,6 +711,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -710,7 +728,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.mobile"; done
-for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 popd
 
 make clean
@@ -739,6 +757,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -753,7 +774,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.tv"; done
-for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 popd
 
 make clean
@@ -781,6 +802,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -795,7 +819,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.wearable"; done
-for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 popd
 
 make clean
@@ -823,6 +847,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -837,7 +864,7 @@ popd
 
 pushd %{buildroot}%{_libdir}
 for FILE in libdali-adap*.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE.ivi"; done
-for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done 
+for FILE in libdali-*plugin.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
 popd
 
 make clean
@@ -866,6 +893,9 @@ make clean
 %endif
 %if 0%{?enable_debug}
            --enable-debug \
+%endif
+%if 0%{?enable_trace}
+           --enable-trace \
 %endif
            --enable-appfw=yes \
            $configure_flags --libdir=%{_libdir} \
@@ -902,7 +932,7 @@ mv dali-adaptor*.pc %{buildroot}%{_libdir}/pkgconfig/
 popd
 
 ################################################
-#rename 
+#rename
 ###############################################
 pushd %{buildroot}%{_libdir}