[gtk: 10/14] profiler: Add profiler marks for when surfaces are mapped and unmapped
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 10/14] profiler: Add profiler marks for when surfaces are mapped and unmapped
- Date: Wed, 12 Feb 2020 14:33:16 +0000 (UTC)
commit e3a67385f445050721878d82e0b3dc5b054fe52d
Author: Alexander Larsson <alexl redhat com>
Date: Wed Feb 12 12:44:43 2020 +0100
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.
gdk/x11/gdkdisplay-x11.c | 9 +++++++++
gdk/x11/gdksurface-x11.c | 9 ++++++++-
gdk/x11/gdksurface-x11.h | 2 ++
3 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index e13f74b822..0d442aac8f 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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;
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index a8172b0d14..b9e122a91a 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -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
diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h
index fe0ece1c19..29f9cf6a6d 100644
--- a/gdk/x11/gdksurface-x11.h
+++ b/gdk/x11/gdksurface-x11.h
@@ -78,6 +78,8 @@ struct _GdkX11Surface
int abs_x;
int abs_y;
+
+ guint64 map_time;
};
struct _GdkX11SurfaceClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]