From: Bowon Ryu Date: Tue, 8 Aug 2023 04:45:05 +0000 (+0900) Subject: Add time function to check text performance X-Git-Tag: dali_2.2.39~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F296963%2F2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Add time function to check text performance Change-Id: Ifc7f72ab466b5b7a2226a232e8e36eff079f2e37 Signed-off-by: Bowon Ryu --- 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. */