Add trace logs to check performance
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
index 89fcf47..3594c91 100644 (file)
 // EXTERNAL_HEADERS
 #include <Ecore_Input.h>
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
 #include <dali/public-api/adaptor-framework/window-enumerations.h>
 #include <dali/public-api/events/mouse-button.h>
 #include <dali/public-api/object/any.h>
+
+#if defined(VCONF_ENABLED)
 #include <vconf-keys.h>
 #include <vconf.h>
+#endif
+
 #include <wayland-egl-tizen.h>
 
 namespace Dali
@@ -50,10 +55,14 @@ 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;
 
+#if defined(VCONF_ENABLED)
 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+#endif
 
 struct KeyCodeMap
 {
@@ -530,6 +539,7 @@ static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
 // Font Callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////
 
+#if defined(VCONF_ENABLED)
 /**
  * Called when a font name is changed.
  */
@@ -553,6 +563,7 @@ static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
     windowBase->OnFontSizeChanged();
   }
 }
+#endif
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 // Window Redraw Request Event Callbacks
@@ -725,8 +736,10 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surf
 
 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
 {
+#if defined(VCONF_ENABLED)
   vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
   vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
+#endif
 
   for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
   {
@@ -823,9 +836,11 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool
   // Register Window auxiliary event
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
 
+#if defined(VCONF_ENABLED)
   // Register Vconf notify - font name and size
   vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
   vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
+#endif
 
   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
   mDisplay                   = ecore_wl2_display_get(display);
@@ -1189,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)
@@ -1238,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
   }
 }
 
@@ -1262,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)
@@ -1311,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
   }
 }