x11/events: Trace X11 event handling

Traces the type of event, and how much time was spent processing it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
This commit is contained in:
Jonas Ådahl 2021-02-02 23:44:08 +01:00
parent 6c7765439f
commit d956f63d67

View File

@ -518,6 +518,31 @@ get_extension_event_name (MetaX11Display *x11_display,
return NULL; return NULL;
} }
static const char *
get_event_name (MetaX11Display *x11_display,
XEvent *event)
{
const char *name;
XIEvent *input_event;
if (event->type < GenericEvent)
return get_core_event_name (event);
name = get_extension_event_name (x11_display, event);
if (name)
return name;
input_event = get_input_event (x11_display, event);
if (input_event)
{
name = get_xi2_event_name (input_event);
if (name)
return name;
}
return "Unknown event";
}
static void static void
meta_spew_core_event (MetaX11Display *x11_display, meta_spew_core_event (MetaX11Display *x11_display,
XEvent *event, XEvent *event,
@ -1850,7 +1875,7 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
XIEvent *input_event; XIEvent *input_event;
MetaCursorTracker *cursor_tracker; MetaCursorTracker *cursor_tracker;
COGL_TRACE_BEGIN_SCOPED (MetaX11DisplayHandleXevent, COGL_TRACE_BEGIN (MetaX11DisplayHandleXevent,
"X11Display (handle X11 event)"); "X11Display (handle X11 event)");
#if 0 #if 0
@ -1974,6 +1999,11 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
} }
display->current_time = META_CURRENT_TIME; display->current_time = META_CURRENT_TIME;
COGL_TRACE_DESCRIBE (MetaX11DisplayHandleXevent,
get_event_name (x11_display, event));
COGL_TRACE_END (MetaX11DisplayHandleXevent);
return bypass_gtk; return bypass_gtk;
} }