[gtk/matthiasc/for-master-2: 16/16] emojichooser: Add profiler marks for loading



commit d812122010b238841616e62cf0b9ca3ab99fa1ab
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 5 00:47:42 2020 +0100

    emojichooser: Add profiler marks for loading
    
    This is a long-running operation, and worth showing
    in traces.

 gtk/gtkemojichooser.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 9865ce8aeb..f64ce36557 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -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;
 }
 


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