From 5a983dd62d2c305086b7689a7553e8e7dd0ee984 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Wed, 15 Mar 2023 19:59:40 +0900 Subject: [PATCH] Add trace log to check text performance Change-Id: I46d3ee15f5ae797c6741d266b1181e053163cdee Signed-off-by: Bowon Ryu --- .../plugin/font-client-plugin-cache-handler.cpp | 22 ++++++++++++++++++++++ .../plugin/font-client-plugin-impl.cpp | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp b/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp index b0a0527..d7fb50d 100644 --- a/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp +++ b/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include #include // INTERNAL INCLUDES @@ -62,6 +63,9 @@ extern Dali::Integration::Log::Filter* gFontClientLogFilter; namespace { + +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_FONT_PERFORMANCE_MARKER, false); + /** * @brief Maximum size of glyph cache per each font face. */ @@ -591,6 +595,8 @@ void FontClient::Plugin::CacheHandler::ValidateFont(const FontDescription& fontD DALI_LOG_TRACE_METHOD(gFontClientLogFilter); FONT_LOG_DESCRIPTION(fontDescription, ""); + DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_VALIDATE_FONT"); + // Create a font pattern. FcPattern* fontFamilyPattern = CreateFontFamilyPattern(fontDescription); @@ -602,6 +608,13 @@ void FontClient::Plugin::CacheHandler::ValidateFont(const FontDescription& fontD if(matched && (nullptr != characterSet)) { + #if defined(TRACE_ENABLED) + if(gTraceFilter && gTraceFilter->IsTraceEnabled()) + { + DALI_LOG_DEBUG_INFO("DALI_TEXT_VALIDATE_FONT : FcFontMatch : %s, style : %s, %s, %s\n", fontDescription.family.c_str(), FontWidth::Name[fontDescription.width], FontWeight::Name[fontDescription.weight], FontSlant::Name[fontDescription.slant]); + } + #endif + // Add the path to the cache. description.type = FontDescription::FACE_FONT; mFontDescriptionCache.push_back(description); @@ -676,6 +689,15 @@ void FontClient::Plugin::CacheHandler::CacheFallbackFontList(FontDescription&& { DALI_LOG_TRACE_METHOD(gFontClientLogFilter); + DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_FALLBACK_FONTLIST"); + + #if defined(TRACE_ENABLED) + if(gTraceFilter && gTraceFilter->IsTraceEnabled()) + { + DALI_LOG_DEBUG_INFO("DALI_TEXT_FALLBACK_FONTLIST : FcFontSort : %s\n", fontDescription.family.c_str()); + } + #endif + fontList = new FontList; characterSetList = new CharacterSetList; diff --git a/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp b/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp index bc62cba..e319b46 100644 --- a/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp +++ b/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp @@ -21,6 +21,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include @@ -75,6 +76,9 @@ Dali::Integration::Log::Filter* gFontClientLogFilter = Dali::Integration::Log::F namespace { + +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_FONT_PERFORMANCE_MARKER, false); + /** * Conversion from Fractional26.6 to float */ @@ -482,6 +486,8 @@ FontId FontClient::Plugin::FindFallbackFont(Character charcode, DALI_LOG_TRACE_METHOD(gFontClientLogFilter); FONT_LOG_REQUEST(charcode, requestedPointSize, preferColor); + DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_FIND_FALLBACKFONT"); + // The font id to be returned. FontId fontId = 0u; @@ -499,6 +505,13 @@ FontId FontClient::Plugin::FindFallbackFont(Character charcode, DALI_LOG_INFO(gFontClientLogFilter, Debug::Verbose, " [%s] --> [%s]\n", FontWidth::Name[preferredFontDescription.width], FontWidth::Name[fontDescription.width]); DALI_LOG_INFO(gFontClientLogFilter, Debug::Verbose, " [%s] --> [%s]\n", FontSlant::Name[preferredFontDescription.slant], FontSlant::Name[fontDescription.slant]); + #if defined(TRACE_ENABLED) + if(gTraceFilter && gTraceFilter->IsTraceEnabled()) + { + DALI_LOG_DEBUG_INFO("DALI_TEXT_FIND_FALLBACKFONT : %s -> %s\n", preferredFontDescription.family.c_str(), fontDescription.family.c_str()); + } + #endif + // Check first if the font's description has been queried before. FontList* fontList = nullptr; CharacterSetList* characterSetList = nullptr; @@ -1016,8 +1029,16 @@ FontId FontClient::Plugin::CreateFont(const FontPath& path, DALI_LOG_INFO(gFontClientLogFilter, Debug::General, " path : [%s]\n", path.c_str()); DALI_LOG_INFO(gFontClientLogFilter, Debug::General, " requestedPointSize : %d\n", requestedPointSize); + DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_CREATE_FONT"); FontId fontId = 0u; + #if defined(TRACE_ENABLED) + if(gTraceFilter && gTraceFilter->IsTraceEnabled()) + { + DALI_LOG_DEBUG_INFO("DALI_TEXT_CREATE_FONT : FT_New_Face : %s\n", path.c_str()); + } + #endif + // Create & cache new font face FT_Face ftFace; int error = FT_New_Face(mFreeTypeLibrary, -- 2.7.4