[gtk/builder-precompile: 2/5] builder: Add profiler marks for parsing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/builder-precompile: 2/5] builder: Add profiler marks for parsing
- Date: Wed, 29 Jan 2020 14:55:17 +0000 (UTC)
commit 98486c2b47a14779318a92626e15cadc61b6eb1a
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 29 15:49:56 2020 +0100
builder: Add profiler marks for parsing
This is useful to understand what ui files take
long to load.
gtk/gtkbuilderparser.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index ff38c49405..7b781c17d1 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -26,6 +26,7 @@
#include "gtkintl.h"
#include "gtktypebuiltins.h"
#include "gtkversion.h"
+#include "gdkprofilerprivate.h"
#include <gio/gio.h>
#include <string.h>
@@ -1548,6 +1549,7 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
const gchar* domain;
ParserData data;
GSList *l;
+ gint64 before = g_get_monotonic_time ();
/* Store the original domain so that interface domain attribute can be
* applied for the builder and the original domain can be restored after
@@ -1622,4 +1624,6 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
/* restore the original domain */
gtk_builder_set_translation_domain (builder, domain);
+
+ gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "builder load", filename);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]