[gtk] window: Add a profiler mark around size allocation



commit 8cb375de11cc20fa5683c0d065bef687d3f9eeb7
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 21 23:43:01 2020 -0500

    window: Add a profiler mark around size allocation
    
    This give a high-level entry for the duration of size allocation
    in the frame cycle.

 gtk/gtkwindow.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index e390e6bca2..ec74cbb30f 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -75,6 +75,7 @@
 
 #include "gdk/gdktextureprivate.h"
 #include "gdk/gdk-private.h"
+#include "gdk/gdkprofilerprivate.h"
 
 #include <cairo-gobject.h>
 #include <errno.h>
@@ -6014,6 +6015,7 @@ surface_render (GdkSurface     *surface,
                 GtkWidget      *widget)
 {
   gtk_widget_render (widget, surface, region);
+
   return TRUE;
 }
 
@@ -6304,11 +6306,18 @@ void
 gtk_window_check_resize (GtkWindow *self)
 {
   GtkWidget *widget = GTK_WIDGET (self);
+  gint64 before = g_get_monotonic_time ();
 
   if (!_gtk_widget_get_alloc_needed (widget))
     gtk_widget_ensure_allocate (widget);
   else if (gtk_widget_get_visible (widget))
     gtk_window_move_resize (self);
+
+  if (gdk_profiler_is_running ())
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "layout", "");
+    }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]