Allow worker thread trace + Trace during image works 56/297056/5
authorEunki Hong <eunkiki.hong@samsung.com>
Wed, 9 Aug 2023 13:09:34 +0000 (22:09 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 9 Aug 2023 23:26:43 +0000 (08:26 +0900)
Let we add trace marker during image load & apply masking.
It will be helpful when we detect performance bottleneck.

Change-Id: I3c629a6b018cdb6bb5e700a8809557e8475fd1cf
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
dali-toolkit/internal/controls/gl-view/gl-view-render-thread.cpp
dali-toolkit/internal/controls/gl-view/gl-view-render-thread.h
dali-toolkit/internal/image-loader/fast-track-loading-task.cpp
dali-toolkit/internal/image-loader/loading-task.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h
dali-toolkit/internal/visuals/svg/svg-task.cpp

index 8f3095f..ca52b18 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/adaptor-framework/scene-holder.h>
 
-#include <toolkit-scene-holder-impl.h>
-#include <toolkit-adaptor-impl.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/scene.h>
 #include <test-application.h>
+#include <toolkit-adaptor-impl.h>
+#include <toolkit-scene-holder-impl.h>
 #include <toolkit-test-application.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
 namespace Adaptor
 {
-
 ///////////////////////////////////////////////////////////////////////////////
 //
 // Dali::Internal::Adaptor::Adaptor Stub
@@ -49,14 +47,14 @@ Dali::Adaptor* gAdaptor = nullptr;
 
 Dali::Adaptor& Adaptor::New()
 {
-  DALI_ASSERT_ALWAYS( ! gAdaptor );
+  DALI_ASSERT_ALWAYS(!gAdaptor);
   gAdaptor = new Dali::Adaptor;
   return *gAdaptor;
 }
 
 Dali::Adaptor& Adaptor::Get()
 {
-  DALI_ASSERT_ALWAYS( gAdaptor );
+  DALI_ASSERT_ALWAYS(gAdaptor);
   return *gAdaptor;
 }
 
@@ -69,33 +67,32 @@ Adaptor::~Adaptor()
   gAdaptor = nullptr;
 }
 
-void Adaptor::Start( Dali::Window window )
+void Adaptor::Start(Dali::Window window)
 {
-  AddWindow( &GetImplementation( window ) );
+  AddWindow(&GetImplementation(window));
 }
 
-Integration::Scene Adaptor::GetScene( Dali::Window window )
+Integration::Scene Adaptor::GetScene(Dali::Window window)
 {
   return window.GetScene();
 }
 
-bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
+bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
 {
-  mCallbacks.PushBack( callback );
+  mCallbacks.PushBack(callback);
   return true;
 }
 
-void Adaptor::RemoveIdle( CallbackBase* callback )
+void Adaptor::RemoveIdle(CallbackBase* callback)
 {
-  mCallbacks.Erase( std::find_if( mCallbacks.Begin(), mCallbacks.End(),
-                                  [ &callback ] ( CallbackBase* current ) { return callback == current; } ) );
+  mCallbacks.Erase(std::find_if(mCallbacks.Begin(), mCallbacks.End(), [&callback](CallbackBase* current) { return callback == current; }));
 }
 
 void Adaptor::RunIdles()
 {
-  for( auto& callback : mCallbacks )
+  for(auto& callback : mCallbacks)
   {
-    CallbackBase::Execute( *callback );
+    CallbackBase::Execute(*callback);
   }
 
   mCallbacks.Clear();
@@ -103,22 +100,22 @@ void Adaptor::RunIdles()
 
 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
 {
-  DALI_ASSERT_ALWAYS( ! mWindows.empty() );
+  DALI_ASSERT_ALWAYS(!mWindows.empty());
 
-  return reinterpret_cast < Dali::RenderSurfaceInterface& >( mWindows.front()->GetRenderSurface() );
+  return reinterpret_cast<Dali::RenderSurfaceInterface&>(mWindows.front()->GetRenderSurface());
 }
 
 Dali::WindowContainer Adaptor::GetWindows()
 {
   Dali::WindowContainer windows;
 
-  for ( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  for(auto iter = mWindows.begin(); iter != mWindows.end(); ++iter)
   {
     // Downcast to Dali::Window
-    Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( *iter ) );
-    if ( window )
+    Dali::Window window(dynamic_cast<Dali::Internal::Adaptor::Window*>(*iter));
+    if(window)
     {
-      windows.push_back( window );
+      windows.push_back(window);
     }
   }
 
@@ -129,21 +126,21 @@ Dali::SceneHolderList Adaptor::GetSceneHolders()
 {
   Dali::SceneHolderList sceneHolderList;
 
-  for( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  for(auto iter = mWindows.begin(); iter != mWindows.end(); ++iter)
   {
-    sceneHolderList.push_back( Dali::Integration::SceneHolder( *iter ) );
+    sceneHolderList.push_back(Dali::Integration::SceneHolder(*iter));
   }
 
   return sceneHolderList;
 }
 
-Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor )
+Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow(Dali::Actor& actor)
 {
-  Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor );
+  Dali::Integration::Scene scene = Dali::Integration::Scene::Get(actor);
 
-  for( auto window : mWindows )
+  for(auto window : mWindows)
   {
-    if ( scene == window->GetScene() )
+    if(scene == window->GetScene())
     {
       return window;
     }
@@ -152,39 +149,39 @@ Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor )
   return nullptr;
 }
 
-void Adaptor::AddWindow( Internal::Adaptor::SceneHolder* window )
+void Adaptor::AddWindow(Internal::Adaptor::SceneHolder* window)
 {
-  if ( window )
+  if(window)
   {
-    mWindows.push_back( window );
+    mWindows.push_back(window);
 
-    Dali::Integration::SceneHolder newWindow( window );
-    mWindowCreatedSignal.Emit( newWindow );
+    Dali::Integration::SceneHolder newWindow(window);
+    mWindowCreatedSignal.Emit(newWindow);
   }
 }
 
-void Adaptor::RemoveWindow( Internal::Adaptor::SceneHolder* window )
+void Adaptor::RemoveWindow(Internal::Adaptor::SceneHolder* window)
 {
-  auto iter = std::find( mWindows.begin(), mWindows.end(), window );
-  if( iter != mWindows.end() )
+  auto iter = std::find(mWindows.begin(), mWindows.end(), window);
+  if(iter != mWindows.end())
   {
-    mWindows.erase( iter );
+    mWindows.erase(iter);
   }
 }
 
-void Adaptor::RegisterProcessor( Integration::Processor& processor, bool postProcessor )
+void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
 {
   Integration::Core& core = mTestApplication->GetCore();
-  core.RegisterProcessor( processor, postProcessor );
+  core.RegisterProcessor(processor, postProcessor);
 }
 
-void Adaptor::UnregisterProcessor( Integration::Processor& processor, bool postProcessor )
+void Adaptor::UnregisterProcessor(Integration::Processor& processor, bool postProcessor)
 {
   Integration::Core& core = mTestApplication->GetCore();
-  core.UnregisterProcessor( processor, postProcessor );
+  core.UnregisterProcessor(processor, postProcessor);
 }
 
-void Adaptor::SetApplication( Dali::TestApplication& testApplication )
+void Adaptor::SetApplication(Dali::TestApplication& testApplication)
 {
   mTestApplication = &testApplication;
 }
@@ -214,7 +211,7 @@ Dali::Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
 ///////////////////////////////////////////////////////////////////////////////
 
 Adaptor::Adaptor()
-: mImpl( new Internal::Adaptor::Adaptor )
+: mImpl(new Internal::Adaptor::Adaptor)
 {
 }
 
@@ -240,21 +237,21 @@ void Adaptor::Stop()
 {
 }
 
-bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
+bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
 {
-  return mImpl->AddIdle( callback, hasReturnValue );
+  return mImpl->AddIdle(callback, hasReturnValue);
 }
 
-void Adaptor::RemoveIdle( CallbackBase* callback )
+void Adaptor::RemoveIdle(CallbackBase* callback)
 {
-  mImpl->RemoveIdle( callback );
+  mImpl->RemoveIdle(callback);
 }
 
-void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
+void Adaptor::ReplaceSurface(Window window, Dali::RenderSurfaceInterface& surface)
 {
 }
 
-void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
+void Adaptor::ReplaceSurface(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface)
 {
 }
 
@@ -294,7 +291,7 @@ Any Adaptor::GetNativeWindowHandle()
   return window;
 }
 
-Any Adaptor::GetNativeWindowHandle( Actor actor )
+Any Adaptor::GetNativeWindowHandle(Actor actor)
 {
   return GetNativeWindowHandle();
 }
@@ -303,7 +300,7 @@ void Adaptor::ReleaseSurfaceLock()
 {
 }
 
-void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
+void Adaptor::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender)
 {
 }
 
@@ -325,15 +322,15 @@ void Adaptor::NotifyLanguageChanged()
 {
 }
 
-void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
+void Adaptor::FeedTouchPoint(TouchPoint& point, int timeStamp)
 {
 }
 
-void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
+void Adaptor::FeedWheelEvent(WheelEvent& wheelEvent)
 {
 }
 
-void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
+void Adaptor::FeedKeyEvent(KeyEvent& keyEvent)
 {
 }
 
@@ -358,24 +355,51 @@ public:
   }
 };
 
-LogFactory* gLogFactory = NULL;
+LogFactory*                gLogFactory = NULL;
 const LogFactoryInterface& Adaptor::GetLogFactory()
 {
-  if( gLogFactory == NULL )
+  if(gLogFactory == NULL)
   {
     gLogFactory = new LogFactory;
   }
   return *gLogFactory;
 }
 
-void Adaptor::RegisterProcessor( Integration::Processor& processor, bool postProcessor)
+class TraceFactory : public TraceFactoryInterface
+{
+public:
+  virtual void InstallTraceFunction() const
+  {
+    Dali::Integration::Trace::LogContextFunction logContextFunction(&TestApplication::LogContext);
+    Dali::Integration::Trace::InstallLogContextFunction(logContextFunction);
+  }
+
+  TraceFactory()
+  {
+  }
+  virtual ~TraceFactory()
+  {
+  }
+};
+
+TraceFactory*                gTraceFactory = NULL;
+const TraceFactoryInterface& Adaptor::GetTraceFactory()
+{
+  if(gTraceFactory == NULL)
+  {
+    gTraceFactory = new TraceFactory;
+  }
+  return *gTraceFactory;
+}
+
+void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
 {
-  mImpl->RegisterProcessor( processor, postProcessor );
+  mImpl->RegisterProcessor(processor, postProcessor);
 }
 
-void Adaptor::UnregisterProcessor( Integration::Processor& processor, bool postProcessor)
+void Adaptor::UnregisterProcessor(Integration::Processor& processor, bool postProcessor)
 {
-  mImpl->UnregisterProcessor( processor, postProcessor );
+  mImpl->UnregisterProcessor(processor, postProcessor);
 }
 
 } // namespace Dali
index 3e84cfd..391dd34 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -43,6 +43,7 @@ constexpr uint64_t DEFAULT_FRAME_DURATION_IN_NANOSECONDS(DEFAULT_FRAME_DURATION_
 
 GlViewRenderThread::GlViewRenderThread(Dali::NativeImageSourceQueuePtr queue)
 : mLogFactory(Dali::Adaptor::Get().GetLogFactory()),
+  mTraceFactory(Dali::Adaptor::Get().GetTraceFactory()),
   mSurfaceSize(1, 1),
   mNativeImageSurface(),
   mNativeImageQueue(queue),
@@ -154,6 +155,7 @@ void GlViewRenderThread::Run()
 {
   Dali::SetThreadName("GlViewRenderer");
   mLogFactory.InstallLogFunction();
+  mTraceFactory.InstallTraceFunction();
 
   int renderFrameResult = 0;
 
index 753526e..cc5f45a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_GL_VIEW_THREAD_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -25,6 +25,7 @@
 #include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/adaptor-framework/log-factory-interface.h>
 #include <dali/integration-api/adaptor-framework/native-image-surface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/signals/callback.h>
 
@@ -145,11 +146,13 @@ private:
   void SleepUntil(uint64_t timeInNanoseconds);
 
 private:
-  const Dali::LogFactoryInterface& mLogFactory;
-  Dali::Vector2                    mSurfaceSize; ///< The size of mNativeImageQueue
-  Dali::NativeImageSurfacePtr      mNativeImageSurface;
-  Dali::NativeImageSourceQueuePtr  mNativeImageQueue;
-  Semaphore<>                      mSurfaceSemaphore; ///< The semaphore to avoid race condition to the render target
+  const Dali::LogFactoryInterface&   mLogFactory;
+  const Dali::TraceFactoryInterface& mTraceFactory;
+
+  Dali::Vector2                   mSurfaceSize; ///< The size of mNativeImageQueue
+  Dali::NativeImageSurfacePtr     mNativeImageSurface;
+  Dali::NativeImageSourceQueuePtr mNativeImageQueue;
+  Semaphore<>                     mSurfaceSemaphore; ///< The semaphore to avoid race condition to the render target
 
   std::unique_ptr<CallbackBase> mGlInitCallback;
   std::unique_ptr<CallbackBase> mGlRenderFrameCallback;
index 607abbc..cd97cc2 100644 (file)
 #include <dali/devel-api/adaptor-framework/texture-upload-manager.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/texture-integ.h>
+#include <dali/integration-api/trace.h>
+
+#ifdef TRACE_ENABLED
+#include <sstream>
+#endif
 
 namespace Dali
 {
@@ -30,6 +35,11 @@ namespace Toolkit
 {
 namespace Internal
 {
+namespace
+{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_IMAGE_PERFORMANCE_MARKER, false);
+}
+
 FastTrackLoadingTask::FastTrackLoadingTask(const VisualUrl& url, ImageDimensions dimensions, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, CallbackBase* callback)
 : AsyncTask(MakeCallback(this, &FastTrackLoadingTask::OnComplete), url.GetProtocolType() == VisualUrl::ProtocolType::REMOTE ? AsyncTask::PriorityType::LOW : AsyncTask::PriorityType::HIGH),
   mUrl(url),
@@ -91,6 +101,15 @@ bool FastTrackLoadingTask::IsReady()
 
 void FastTrackLoadingTask::Load()
 {
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[url:" << mUrl.GetUrl() << "]";
+    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_IMAGE_FAST_TRACK_UPLOADING_TASK", oss.str().c_str());
+  }
+#endif
+
   Devel::PixelBuffer              pixelBuffer;
   std::vector<Devel::PixelBuffer> pixelBuffers;
 
@@ -128,6 +147,21 @@ void FastTrackLoadingTask::Load()
       DALI_LOG_ERROR("FastTrackLoadingTask::Load: ??? Undefined case. PixelBuffers.size() : %zu : ResourceId : %d, url : [%s]\n", pixelBuffers.size(), mResourceId, mUrl.GetUrl().c_str());
     }
   }
+
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[";
+    oss << "pixelBuffers: " << pixelBuffers.size() << " ";
+    if(!pixelBuffers.empty())
+    {
+      oss << "premult:" << mPremultiplied << " ";
+    }
+    oss << "url:" << mUrl.GetUrl() << "]";
+    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_IMAGE_FAST_TRACK_UPLOADING_TASK", oss.str().c_str());
+  }
+#endif
 }
 
 void FastTrackLoadingTask::MultiplyAlpha(Dali::Devel::PixelBuffer pixelBuffer)
index e81b16f..a1fcd63 100644 (file)
  */
 
 // CLASS HEADER
-#include "loading-task.h"
+#include <dali-toolkit/internal/image-loader/loading-task.h>
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/devel-api/adaptor-framework/thread-settings.h>
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
 #include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
 
+#ifdef TRACE_ENABLED
+#include <sstream>
+#endif
+
 namespace Dali
 {
 namespace Toolkit
 {
 namespace Internal
 {
+namespace
+{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_IMAGE_PERFORMANCE_MARKER, false);
+}
+
 LoadingTask::LoadingTask(uint32_t id, Dali::AnimatedImageLoading animatedImageLoading, uint32_t frameIndex, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, CallbackBase* callback)
 : AsyncTask(callback),
   url(),
@@ -148,6 +158,15 @@ LoadingTask::~LoadingTask()
 
 void LoadingTask::Process()
 {
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[url:" << (!!(animatedImageLoading) ? animatedImageLoading.GetUrl() : url.GetUrl()) << "]";
+    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_IMAGE_LOADING_TASK", oss.str().c_str());
+  }
+#endif
+
   isReady = false;
   if(!isMaskTask)
   {
@@ -159,6 +178,23 @@ void LoadingTask::Process()
   }
   MultiplyAlpha();
   isReady = true;
+
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[";
+    oss << "masking:" << isMaskTask << " ";
+    oss << "index: " << frameIndex << " ";
+    oss << "pixelBuffers: " << pixelBuffers.size() << " ";
+    if(!pixelBuffers.empty())
+    {
+      oss << "premult:" << pixelBuffers[0].IsAlphaPreMultiplied() << " ";
+    }
+    oss << "url:" << (!!(animatedImageLoading) ? animatedImageLoading.GetUrl() : url.GetUrl()) << "]";
+    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_IMAGE_LOADING_TASK", oss.str().c_str());
+  }
+#endif
 }
 
 bool LoadingTask::IsReady()
index b1e9bea..c19a440 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
 #include <dali/public-api/math/math-utils.h>
 #include <dali/public-api/object/property-array.h>
 
 #include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h>
 #include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
 
+#ifdef TRACE_ENABLED
+#include <sstream>
+#endif
+
 namespace Dali
 {
 namespace Toolkit
@@ -43,6 +48,8 @@ constexpr auto MICROSECONDS_PER_SECOND(1e+6);
 Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_VECTOR_ANIMATION");
 #endif
 
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_IMAGE_PERFORMANCE_MARKER, false);
+
 } // unnamed namespace
 
 VectorAnimationTask::VectorAnimationTask(VisualFactoryCache& factoryCache)
@@ -136,6 +143,8 @@ bool VectorAnimationTask::IsAnimating()
 
 bool VectorAnimationTask::Load(bool synchronousLoading)
 {
+  DALI_TRACE_SCOPE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK");
+
   if(!mVectorRenderer.Load(mUrl))
   {
     DALI_LOG_ERROR("VectorAnimationTask::Load: Load failed [%s]\n", mUrl.c_str());
@@ -452,6 +461,8 @@ bool VectorAnimationTask::Rasterize()
     return false;
   }
 
+  DALI_TRACE_BEGIN(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK");
+
   ApplyAnimationData();
 
   if(mPlayState == PlayState::PLAYING && mUpdateFrameNumber)
@@ -559,6 +570,18 @@ bool VectorAnimationTask::Rasterize()
     mKeepAnimation = true;
   }
 
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[size: " << mWidth << " x " << mHeight << ", ";
+    oss << "frame: " << mCurrentFrame << ", ";
+    oss << "loop: " << mCurrentLoop << ", ";
+    oss << "state : " << mPlayState << "]";
+    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", oss.str().c_str());
+  }
+#endif
+
   return true;
 }
 
index 9d2cfbe..66a9f14 100644 (file)
@@ -47,7 +47,8 @@ VectorAnimationThread::VectorAnimationThread()
   mConditionalWait(),
   mNeedToSleep(false),
   mDestroyThread(false),
-  mLogFactory(Dali::Adaptor::Get().GetLogFactory())
+  mLogFactory(Dali::Adaptor::Get().GetLogFactory()),
+  mTraceFactory(Dali::Adaptor::Get().GetTraceFactory())
 {
   mAsyncTaskManager = Dali::AsyncTaskManager::Get();
   mSleepThread.Start();
@@ -176,6 +177,7 @@ void VectorAnimationThread::Run()
 {
   SetThreadName("VectorAnimationThread");
   mLogFactory.InstallLogFunction();
+  mTraceFactory.InstallTraceFunction();
 
   while(!mDestroyThread)
   {
@@ -289,6 +291,7 @@ VectorAnimationThread::SleepThread::SleepThread(CallbackBase* callback)
   mAwakeCallback(std::unique_ptr<CallbackBase>(callback)),
   mSleepTimePoint(),
   mLogFactory(Dali::Adaptor::Get().GetLogFactory()),
+  mTraceFactory(Dali::Adaptor::Get().GetTraceFactory()),
   mNeedToSleep(false),
   mDestroyThread(false)
 {
@@ -318,6 +321,7 @@ void VectorAnimationThread::SleepThread::Run()
 {
   SetThreadName("VectorSleepThread");
   mLogFactory.InstallLogFunction();
+  mTraceFactory.InstallTraceFunction();
 
   while(!mDestroyThread)
   {
index 14aa6c9..07537c5 100644 (file)
@@ -21,6 +21,7 @@
 #include <dali/devel-api/threading/conditional-wait.h>
 #include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
 #include <dali/public-api/adaptor-framework/round-robin-container-view.h>
 #include <dali/public-api/signals/connection-tracker.h>
 #include <memory>
@@ -145,6 +146,7 @@ private:
     std::unique_ptr<CallbackBase>                      mAwakeCallback;
     std::chrono::time_point<std::chrono::steady_clock> mSleepTimePoint;
     const Dali::LogFactoryInterface&                   mLogFactory;
+    const Dali::TraceFactoryInterface&                 mTraceFactory;
     bool                                               mNeedToSleep;
     bool                                               mDestroyThread;
   };
@@ -168,6 +170,7 @@ private:
   bool                                 mDestroyThread;
   bool                                 mEventTriggered{false};
   const Dali::LogFactoryInterface&     mLogFactory;
+  const Dali::TraceFactoryInterface&   mTraceFactory;
   Dali::AsyncTaskManager               mAsyncTaskManager;
 };
 
index 7b8ef29..bcd0f91 100644 (file)
 #include <dali/devel-api/adaptor-framework/file-loader.h>
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/svg/svg-visual.h>
 
+#ifdef TRACE_ENABLED
+#include <sstream>
+#endif
+
 namespace Dali
 {
 namespace Toolkit
 {
 namespace Internal
 {
+namespace
+{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_IMAGE_PERFORMANCE_MARKER, false);
+}
+
 SvgTask::SvgTask(VectorImageRenderer vectorRenderer, CallbackBase* callback, AsyncTask::PriorityType priorityType)
 : AsyncTask(callback, priorityType),
   mVectorRenderer(vectorRenderer),
@@ -74,6 +84,8 @@ void SvgLoadingTask::Process()
     return;
   }
 
+  DALI_TRACE_SCOPE(gTraceFilter, "DALI_SVG_LOADING_TASK");
+
   Dali::Vector<uint8_t> buffer;
 
   if(!mUrl.IsLocalResource())
@@ -128,15 +140,26 @@ void SvgRasterizingTask::Process()
     return;
   }
 
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[size: " << mWidth << " x " << mHeight << "]";
+    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
+  }
+#endif
+
   Devel::PixelBuffer pixelBuffer = mVectorRenderer.Rasterize(mWidth, mHeight);
   if(!pixelBuffer)
   {
     DALI_LOG_ERROR("Rasterize is failed!\n");
+    DALI_TRACE_END(gTraceFilter, "DALI_SVG_RASTERIZE_TASK");
     return;
   }
 
   mPixelData    = Devel::PixelBuffer::Convert(pixelBuffer);
   mHasSucceeded = true;
+  DALI_TRACE_END(gTraceFilter, "DALI_SVG_RASTERIZE_TASK");
 }
 
 bool SvgRasterizingTask::IsReady()