emojichooser: Add profiler marks for loading
authorMatthias Clasen <mclasen@redhat.com>
Tue, 4 Feb 2020 23:47:42 +0000 (00:47 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 5 Feb 2020 11:28:39 +0000 (06:28 -0500)
This is a long-running operation, and worth showing
in traces.

gtk/gtkemojichooser.c

index 9865ce8aebbd497d1f321d34091eea2e410c948a..f64ce36557d4ef1daf59265818ec87718fba2956 100644 (file)
@@ -35,6 +35,7 @@
 #include "gtksearchentryprivate.h"
 #include "gtkstylecontext.h"
 #include "gtktext.h"
+#include "gdk/gdkprofilerprivate.h"
 
 #define BOX_SPACE 6
 
@@ -451,7 +452,11 @@ populate_emoji_chooser (gpointer data)
 
       now = g_get_monotonic_time ();
       if (now > start + 8000)
-        return G_SOURCE_CONTINUE;
+        {
+          if (gdk_profiler_is_running ())
+            gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "emojichooser", "populate");
+          return G_SOURCE_CONTINUE;
+        }
     }
 
   g_variant_iter_free (chooser->iter);
@@ -459,6 +464,12 @@ populate_emoji_chooser (gpointer data)
   chooser->box = NULL;
   chooser->populate_idle = 0;
 
+  if (gdk_profiler_is_running ())
+    {
+      now = g_get_monotonic_time ();
+      gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "emojichooser", "populate (finish)");
+    }
+
   return G_SOURCE_REMOVE;
 }