From: Heeyong Song Date: Wed, 18 Jan 2023 09:00:39 +0000 (+0900) Subject: [Tizen] Add performance log X-Git-Tag: accepted/tizen/7.0/unified/20230203.164140^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=71a3786bb364b30639b522307cf33824365b1d17 [Tizen] Add performance log Print a log when eglQuerySurface takes long time Change-Id: Iae3810cfbf5f25076e5be4be536be46e7e63c955 --- diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index 632cc40..09d8867 100644 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 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,8 +25,10 @@ #include // INTERNAL INCLUDES +#include #include #include +#include #include // EGL constants use C style casts @@ -43,7 +45,17 @@ const std::string EGL_KHR_CREATE_CONTEXT = "EGL_KHR_create_cont const std::string EGL_KHR_PARTIAL_UPDATE = "EGL_KHR_partial_update"; const std::string EGL_KHR_SWAP_BUFFERS_WITH_DAMAGE = "EGL_KHR_swap_buffers_with_damage"; +// Threshold time in miliseconds +constexpr auto PERFORMANCE_LOG_THRESHOLD_TIME_ENV = "DALI_EGL_PERFORMANCE_LOG_THRESHOLD_TIME"; + DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_EGL, true); + +uint32_t GetPerformanceLogThresholdTime() +{ + auto timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(PERFORMANCE_LOG_THRESHOLD_TIME_ENV); + uint32_t time = timeString ? static_cast(std::atoi(timeString)) : 0u; + return time; +} } // namespace namespace Dali @@ -407,6 +419,15 @@ void EglImplementation::SwapBuffers(EGLSurface& eglSurface) EGLint EglImplementation::GetBufferAge(EGLSurface& eglSurface) const { + static uint32_t logThreshold = GetPerformanceLogThresholdTime(); + static bool logEnabled = logThreshold > 0 ? true : false; + + uint32_t startTime, endTime; + if(logEnabled) + { + startTime = TimeService::GetMilliSeconds(); + } + EGLint age = 0; eglQuerySurface(mEglDisplay, eglSurface, EGL_BUFFER_AGE_EXT, &age); if(age < 0) @@ -414,6 +435,15 @@ EGLint EglImplementation::GetBufferAge(EGLSurface& eglSurface) const DALI_LOG_ERROR("eglQuerySurface(%d)\n", eglGetError()); age = 0; } + + if(logEnabled) + { + endTime = TimeService::GetMilliSeconds(); + if(endTime - startTime > logThreshold) + { + DALI_LOG_DEBUG_INFO("eglQuerySurface takes long time! [%u ms]\n", endTime - startTime); + } + } return age; }