e_comp_wl: add log of gap idle_exiter between prepare callback of wayland event loop 09/285309/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 7 Dec 2022 10:38:36 +0000 (19:38 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 9 Dec 2022 02:10:13 +0000 (11:10 +0900)
if the job of main thread has much time or does not get CPU scheduling, the synchronous call
(ex: wl_display roundtrip) is blocked until the job is done. it is the regular operation of
a synchronous call but sometimes it has too much time.
this patch is for debugging it.

Change-Id: Ife0d9f0ad32807fd892c7b2f991d966427c0c72c

src/bin/e_comp_wl.c
src/bin/e_comp_wl.h

index f94566716d85c24b3e7a8c086127e7ea4d657b52..fcadd0afe38d15cb00903a552942728d02128e18 100644 (file)
@@ -12,6 +12,8 @@
 
 #define COMPOSITOR_VERSION 4
 
+#define E_COM_WL_PREPARE_GAP_LOG_TIME 2000
+
 EINTERN int E_EVENT_WAYLAND_GLOBAL_ADD = -1;
 #include "session-recovery-server-protocol.h"
 
@@ -250,6 +252,14 @@ _e_comp_wl_focus_check(void)
      e_grabinput_focus(e_comp->ee_win, E_FOCUS_METHOD_PASSIVE);
 }
 
+static Eina_Bool
+_e_comp_wl_cb_idle_exiter(void *data EINA_UNUSED)
+{
+   e_comp_wl->idle_exiter_timestamp = ecore_time_get() * 1000;
+
+   return ECORE_CALLBACK_RENEW;
+}
+
 static Eina_Bool
 _e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED)
 {
@@ -262,6 +272,20 @@ _e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED)
 static void
 _e_comp_wl_cb_prepare(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED)
 {
+   double gap_time;
+
+   if (e_comp_wl->idle_exiter_timestamp > 0.0)
+     {
+        gap_time = (ecore_time_get() * 1000) - e_comp_wl->idle_exiter_timestamp;
+        if (gap_time > E_COM_WL_PREPARE_GAP_LOG_TIME)
+          {
+             ELOGF("E_COMP", "gap between idle_exiter with cb_prepare is %lfms",
+                   NULL, gap_time);
+          }
+     }
+
+   e_comp_wl->idle_exiter_timestamp = 0.0;
+
    /* flush pending client events */
    wl_display_flush_clients(e_comp_wl->wl.disp);
 }
@@ -4394,6 +4418,8 @@ e_comp_wl_init(void)
 
    E_EVENT_WAYLAND_GLOBAL_ADD = ecore_event_type_new();
 
+   e_comp_wl->idle_exiter = ecore_idle_exiter_add(_e_comp_wl_cb_idle_exiter, NULL);
+
    TRACE_DS_END();
    return EINA_TRUE;
 }
@@ -4408,6 +4434,8 @@ e_comp_wl_deferred_job(void)
 EINTERN void
 e_comp_wl_shutdown(void)
 {
+   ecore_idle_exiter_del(e_comp_wl->idle_exiter);
+
    e_comp_wl_subsurfaces_shutdown();
    /* free handlers */
    E_FREE_LIST(handlers, ecore_event_handler_del);
index 3fda11c559e58b4c74ec221fac6fd5353024cb98..3ca51742743ae1a2e1fe6e52c6ba45693a6c632c 100644 (file)
@@ -354,6 +354,9 @@ struct _E_Comp_Wl_Data
    void *drag_offer;
 
    E_Comp_Wl_Evas_Gl *evas_gl;
+
+   double idle_exiter_timestamp;
+   Ecore_Idle_Exiter *idle_exiter;
 };
 
 struct _E_Comp_Wl_Client_Data