profiler: Add profiler marks for when surfaces are mapped and unmapped

This is done on the X11 side so we can tell when the map/unmap takes
effect and how long it took since the map request.
This commit is contained in:
Alexander Larsson 2020-02-12 12:44:43 +01:00
parent b4b00e2887
commit e3a67385f4
3 changed files with 19 additions and 1 deletions

View File

@ -881,6 +881,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
gdk_surface_freeze_updates (surface);
_gdk_x11_surface_grab_check_unmap (surface, xevent->xany.serial);
if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_markf (g_get_monotonic_time (), 0, "Unmapped window", "0x%lx", GDK_SURFACE_XID (surface));
}
return_val = FALSE;
@ -902,6 +905,12 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
if (toplevel)
gdk_surface_thaw_updates (surface);
if (GDK_PROFILER_IS_RUNNING)
{
gdk_profiler_end_markf (surface_impl->map_time, "Mapped window", "0x%lx", GDK_SURFACE_XID (surface));
surface_impl->map_time = 0;
}
}
return_val = FALSE;

View File

@ -1205,6 +1205,7 @@ gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
GdkToplevelX11 *toplevel;
Display *xdisplay = GDK_SURFACE_XDISPLAY (surface);
Window xwindow = GDK_SURFACE_XID (surface);
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
if (!already_mapped)
set_initial_hints (surface);
@ -1217,7 +1218,13 @@ gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
display_x11->user_time != 0 &&
XSERVER_TIME_IS_LATER (display_x11->user_time, toplevel->user_time))
gdk_x11_surface_set_user_time (surface, display_x11->user_time);
if (GDK_PROFILER_IS_RUNNING)
{
if (impl->map_time == 0)
impl->map_time = g_get_monotonic_time ();
}
XMapWindow (xdisplay, xwindow);
/* Fullscreen on current monitor is the default, no need to apply this mode

View File

@ -78,6 +78,8 @@ struct _GdkX11Surface
int abs_x;
int abs_y;
guint64 map_time;
};
struct _GdkX11SurfaceClass