[gtk: 9/14] icon theme: Don't add profiler marks for short async icon loads



commit b4b00e28871ffb596eec94617f8699ed90ece2a2
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Feb 12 12:43:27 2020 +0100

    icon theme: Don't add profiler marks for short async icon loads
    
    We do a bunch of preloads, and most of these are not really interesting
    anyway.

 gtk/gtkicontheme.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 3151d3b316..5c1f2dc22c 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3606,8 +3606,13 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
   g_assert (icon->texture != NULL);
 
   if (GDK_PROFILER_IS_RUNNING)
-    gdk_profiler_end_markf (before, in_thread ?  "icon load (thread)" : "icon load" ,
-                            "%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
+    {
+      guint64 end = g_get_monotonic_time ();
+      /* Don't report quick (< 0.5 msec) parses */
+      if (end - before > 500 || !in_thread)
+        gdk_profiler_add_markf (before, (end - before), in_thread ?  "icon load (thread)" : "icon load" ,
+                                "%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
+    }
 }
 
 static GdkTexture *


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