From: Heeyong Song Date: Tue, 18 Oct 2022 10:09:30 +0000 (+0900) Subject: Add trace logs to check performance X-Git-Tag: dali_2.1.45~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F283126%2F2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Add trace logs to check performance Change-Id: I72023f9d7d1d4c70c760df40162162fe48258807 --- diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index eedcbed..a9fbcfe 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,7 @@ namespace { thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false); } // unnamed namespace Dali::Adaptor* Adaptor::New(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode) @@ -912,15 +914,11 @@ void Adaptor::ProcessCoreEvents() mPerformanceInterface->AddMarker(PerformanceInterface::PROCESS_EVENTS_START); } -#if !defined(DALI_PROFILE_UBUNTU) && !defined(DALI_PROFILE_LIBUV_X11) && !defined(DALI_PROFILE_GLIB_X11) - DALI_LOG_RELEASE_INFO("Start ProcessEvents\n"); -#endif + DALI_TRACE_BEGIN(gTraceFilter, "DALI_PROCESS_CORE_EVENTS"); mCore->ProcessEvents(); -#if !defined(DALI_PROFILE_UBUNTU) && !defined(DALI_PROFILE_LIBUV_X11) && !defined(DALI_PROFILE_GLIB_X11) - DALI_LOG_RELEASE_INFO("End ProcessEvents\n"); -#endif + DALI_TRACE_END(gTraceFilter, "DALI_PROCESS_CORE_EVENTS"); if(mPerformanceInterface) { diff --git a/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp b/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp index 41e8205..4a99c5a 100644 --- a/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp +++ b/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp @@ -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. @@ -15,11 +15,15 @@ * */ -// EXTERNAL INCLUDES +// CLASS HEADER #include + +// EXTERNAL INCLUDES +#include #include // INTERNAL INCLUDES +#include namespace Dali { @@ -27,9 +31,21 @@ namespace Internal { namespace Adaptor { +namespace +{ +const char* DALI_TRACE_ENABLE_PRINT_LOG_ENV = "DALI_TRACE_ENABLE_PRINT_LOG"; +static bool gTraceManagerEnablePrintLog = false; + +} // namespace + TraceManagerTizen::TraceManagerTizen(PerformanceInterface* performanceInterface) : TraceManager(performanceInterface) { + const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_TRACE_ENABLE_PRINT_LOG_ENV); + if(enablePrintLog && std::atoi(enablePrintLog) != 0) + { + gTraceManagerEnablePrintLog = true; + } } Dali::Integration::Trace::LogContextFunction TraceManagerTizen::GetLogContextFunction() @@ -42,10 +58,20 @@ void TraceManagerTizen::LogContext(bool start, const char* tag) if(start) { traceBegin(TTRACE_TAG_GRAPHICS, tag); + + if(gTraceManagerEnablePrintLog) + { + DALI_LOG_RELEASE_INFO("BEGIN: %s\n", tag); + } } else { traceEnd(TTRACE_TAG_GRAPHICS); + + if(gTraceManagerEnablePrintLog) + { + DALI_LOG_RELEASE_INFO("END: %s\n", tag); + } } } diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 5d4cb1c..3317792 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -363,7 +363,6 @@ void Window::SetPreferredOrientation(WindowOrientation orientation) WindowOrientation Window::GetPreferredOrientation() { - DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle); WindowOrientation preferredOrientation = ConvertToOrientation(mPreferredAngle); return preferredOrientation; } @@ -699,14 +698,14 @@ Dali::Window::WindowSize Window::GetSize() const void Window::SetPosition(Dali::Window::WindowPosition position) { PositionSize oldRect = mSurface->GetPositionSize(); - int32_t newX = position.GetX(); - int32_t newY = position.GetY(); + int32_t newX = position.GetX(); + int32_t newY = position.GetY(); mWindowSurface->MoveResize(PositionSize(newX, newY, oldRect.width, oldRect.height)); if((oldRect.x != newX) || (oldRect.y != newY)) { - Dali::Window handle(this); + Dali::Window handle(this); Dali::Window::WindowPosition newPosition(newX, newY); DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY()); @@ -891,8 +890,8 @@ void Window::OnWindowRedrawRequest() void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) { - bool resized = false; - bool moved = false; + bool resized = false; + bool moved = false; Dali::Window handle(this); PositionSize oldRect = mSurface->GetPositionSize(); @@ -921,8 +920,8 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) { Uint16Pair newSize(newRect.width, newRect.height); - mWindowWidth = newRect.width; - mWindowHeight = newRect.height; + mWindowWidth = newRect.width; + mWindowHeight = newRect.height; SurfaceResized(); @@ -1128,7 +1127,6 @@ Dali::Window Window::GetParent() WindowOrientation Window::GetCurrentOrientation() const { - DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle); return ConvertToOrientation(mRotationAngle); } diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index 8ddc82d..3594c91 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -31,6 +31,7 @@ // EXTERNAL_HEADERS #include #include +#include #include #include #include @@ -54,6 +55,8 @@ namespace Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE"); #endif +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false); + const uint32_t MAX_TIZEN_CLIENT_VERSION = 7; const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1; @@ -1201,7 +1204,14 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event) std::string keyString(""); std::string compose(""); - DALI_LOG_RELEASE_INFO("OnKeyDown Start [%s]\n", keyName.c_str()); +#ifdef TRACE_ENABLED + std::ostringstream stream; + if(gTraceFilter->IsTraceEnabled()) + { + stream << "DALI_ON_KEY_DOWN [" << keyName << "]\n"; + DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str()); + } +#endif // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string. if(keyEvent->compose) @@ -1250,7 +1260,12 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event) mKeyEventSignal.Emit(keyEvent); - DALI_LOG_RELEASE_INFO("OnKeyDown End [%s]\n", keyName.c_str()); +#ifdef TRACE_ENABLED + if(gTraceFilter->IsTraceEnabled()) + { + DALI_TRACE_END(gTraceFilter, stream.str().c_str()); + } +#endif } } @@ -1274,7 +1289,14 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event) std::string keyString(""); std::string compose(""); - DALI_LOG_RELEASE_INFO("OnKeyUp Start [%s]\n", keyName.c_str()); +#ifdef TRACE_ENABLED + std::ostringstream stream; + if(gTraceFilter->IsTraceEnabled()) + { + stream << "DALI_ON_KEY_UP [" << keyName << "]" << std::endl; + DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str()); + } +#endif // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string. if(keyEvent->compose) @@ -1323,7 +1345,12 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event) mKeyEventSignal.Emit(keyEvent); - DALI_LOG_RELEASE_INFO("OnKeyUp End [%s]\n", keyName.c_str()); +#ifdef TRACE_ENABLED + if(gTraceFilter->IsTraceEnabled()) + { + DALI_TRACE_END(gTraceFilter, stream.str().c_str()); + } +#endif } }