diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-01-22 21:30:22 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-01-22 23:44:01 -0500 |
commit | 9b29da93b6ee90f99c4a49e84b2bbb81e9cd3357 (patch) | |
tree | ccd8fcbbb678853910dd4214830612490f7c92fa | |
parent | 0fe9643728244d53dbd909c745114014dea5333d (diff) | |
download | gtk+-9b29da93b6ee90f99c4a49e84b2bbb81e9cd3357.tar.gz |
iconhelper: Add profiler marks around icon loading
These mainly happen during the first frame, causing
it to be longer than 'normal' frames.
-rw-r--r-- | gtk/gtkiconhelper.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index c891cecbdd..3aeeb8b168 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -35,6 +35,7 @@ #include "gtkscalerprivate.h" #include "gtksnapshot.h" #include "gtkwidgetprivate.h" +#include "gdk/gdkprofilerprivate.h" struct _GtkIconHelper { @@ -143,11 +144,14 @@ gtk_icon_helper_load_paintable (GtkIconHelper *self, GdkPaintable *paintable; GIcon *gicon; gboolean symbolic; + gint64 before = g_get_monotonic_time (); + char *item; switch (gtk_image_definition_get_storage_type (self->def)) { case GTK_IMAGE_PAINTABLE: paintable = g_object_ref (gtk_image_definition_get_paintable (self->def)); + item = g_strdup ("paintable"); symbolic = FALSE; break; @@ -156,6 +160,7 @@ gtk_icon_helper_load_paintable (GtkIconHelper *self, gicon = g_themed_icon_new_with_default_fallbacks (gtk_image_definition_get_icon_name (self->def)); else gicon = g_themed_icon_new (gtk_image_definition_get_icon_name (self->def)); + item = g_icon_to_string (gicon); paintable = ensure_paintable_for_gicon (self, gtk_css_node_get_style (self->node), gtk_widget_get_direction (self->owner), @@ -166,6 +171,7 @@ gtk_icon_helper_load_paintable (GtkIconHelper *self, break; case GTK_IMAGE_GICON: + item = g_icon_to_string (gtk_image_definition_get_gicon (self->def)); paintable = ensure_paintable_for_gicon (self, gtk_css_node_get_style (self->node), gtk_widget_get_direction (self->owner), @@ -178,11 +184,16 @@ gtk_icon_helper_load_paintable (GtkIconHelper *self, default: paintable = NULL; symbolic = FALSE; + item = NULL; break; } *out_symbolic = symbolic; + if (gdk_profiler_is_running ()) + gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "icon helper load", item); + g_free (item); + return paintable; } |