summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-01-22 21:29:47 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-01-22 23:44:01 -0500
commit0fe9643728244d53dbd909c745114014dea5333d (patch)
tree68af2889c807aaf0a85492c5a916a65013b7dedf
parent73a214d1a9b9ed771bf482addf66bf18593fd884 (diff)
downloadgtk+-0fe9643728244d53dbd909c745114014dea5333d.tar.gz
css: Add a profiler mark around theme loading
This is also time spent before the first frame.
-rw-r--r--gtk/gtkcssprovider.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 5201e00c0a..f97776d801 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "gdk/gdkprofilerprivate.h"
#include <cairo-gobject.h>
/**
@@ -1004,6 +1005,8 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
GFile *file,
GBytes *bytes)
{
+ gint64 before = g_get_monotonic_time ();
+
if (bytes == NULL)
{
GError *load_error = NULL;
@@ -1050,6 +1053,13 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
g_bytes_unref (bytes);
}
+
+ if (gdk_profiler_is_running ())
+ {
+ char *uri = g_file_get_uri (file);
+ gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "theme load", uri);
+ g_free (uri);
+ }
}
/**