From ee67463f2b5c25c1d0ab75f879f524c7fbc53c13 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Tue, 8 Aug 2023 13:45:05 +0900 Subject: [PATCH] Add time function to check text performance Change-Id: Ifc7f72ab466b5b7a2226a232e8e36eff079f2e37 Signed-off-by: Bowon Ryu --- dali/devel-api/text-abstraction/font-client.cpp | 25 +++++++++++++++++++++++++ dali/devel-api/text-abstraction/font-client.h | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/dali/devel-api/text-abstraction/font-client.cpp b/dali/devel-api/text-abstraction/font-client.cpp index 11ea888..116c00a 100644 --- a/dali/devel-api/text-abstraction/font-client.cpp +++ b/dali/devel-api/text-abstraction/font-client.cpp @@ -19,6 +19,7 @@ #include // INTERNAL INCLUDES +#include #include namespace Dali @@ -50,6 +51,30 @@ const Size FontClient::MAX_SIZE_FIT_IN_ATLAS(MAX_TEXT_ATLAS_WIDTH - PADDING_TEXT const uint32_t FontClient::NUMBER_OF_POINTS_PER_ONE_UNIT_OF_POINT_SIZE = 64u; //Found this value from toolkit +// For Debug +static bool TEXT_PERFORMANCE_LOG_SET = false; +static uint32_t TEXT_PERFORMANCE_LOG_THRESHOLD_TIME = 0u; +constexpr auto TEXT_PERFORMANCE_LOG_THRESHOLD_TIME_ENV = "DALI_TEXT_PERFORMANCE_LOG_THRESHOLD_TIME"; + +uint32_t FontClient::GetPerformanceLogThresholdTime() +{ + uint32_t time = TEXT_PERFORMANCE_LOG_THRESHOLD_TIME; + if(!TEXT_PERFORMANCE_LOG_SET) + { + // Threshold time in miliseconds. + auto timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(TEXT_PERFORMANCE_LOG_THRESHOLD_TIME_ENV); + time = timeString ? static_cast(std::atoi(timeString)) : 0u; + TEXT_PERFORMANCE_LOG_THRESHOLD_TIME = time; + TEXT_PERFORMANCE_LOG_SET = true; + } + return time; +} + +bool FontClient::IsPerformanceLogEnabled() +{ + return GetPerformanceLogThresholdTime() > 0 ? true : false; +} + // FontClient FontClient FontClient::Get() diff --git a/dali/devel-api/text-abstraction/font-client.h b/dali/devel-api/text-abstraction/font-client.h index ffe3f3b..bce3e4e 100644 --- a/dali/devel-api/text-abstraction/font-client.h +++ b/dali/devel-api/text-abstraction/font-client.h @@ -79,6 +79,10 @@ public: static const uint32_t NUMBER_OF_POINTS_PER_ONE_UNIT_OF_POINT_SIZE; ///< Factor multiply point-size in toolkit. + // For Debug + static uint32_t GetPerformanceLogThresholdTime(); ///< Return performance log threshold time in miliseconds for debug. + static bool IsPerformanceLogEnabled(); ///< Whether performance log is enabled. + /** * @brief Used to load an embedded item into the font client. */ -- 2.7.4