gdk: Add a profiler mark for paint_idle
authorMatthias Clasen <mclasen@redhat.com>
Thu, 23 Jan 2020 02:27:59 +0000 (21:27 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 23 Jan 2020 04:44:01 +0000 (23:44 -0500)
This is the big frame clock function where most
signals are emitted, and it can keep us away from
the mainloop for a long time.

gdk/gdkframeclockidle.c

index 1d11ae4fe714358cd4d074577c79b3642cdc8bc9..29cd57975ffae8a8b56831c7f5fc0d727c95c99f 100644 (file)
@@ -317,6 +317,7 @@ gdk_frame_clock_paint_idle (void *data)
   GdkFrameClockIdlePrivate *priv = clock_idle->priv;
   gboolean skip_to_resume_events;
   GdkFrameTimings *timings = NULL;
+  gint64 before = g_get_monotonic_time ();
 
   priv->paint_idle_id = 0;
   priv->in_paint_idle = TRUE;
@@ -500,6 +501,9 @@ gdk_frame_clock_paint_idle (void *data)
   if (priv->freeze_count == 0)
     priv->sleep_serial = get_sleep_serial ();
 
+  if (gdk_profiler_is_running ())
+    gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "frameclock", "paint_idle");
+
   return FALSE;
 }