[gtksourceview] stylescheme: add profiling data for scheme loading



commit a533eaf0d6641881d6a24f012068ccb112cf9350
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 1 16:05:23 2022 -0700

    stylescheme: add profiling data for scheme loading

 gtksourceview/gtksourcestylescheme.c        | 5 +++++
 gtksourceview/gtksourcestyleschememanager.c | 5 +++++
 2 files changed, 10 insertions(+)
---
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 2c842ec7..5dd80787 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -30,6 +30,7 @@
 #include "gtksourcestyle-private.h"
 #include "gtksourceview.h"
 #include "gtksourcelanguage-private.h"
+#include "gtksourcetrace.h"
 
 /**
  * GtkSourceStyleScheme:
@@ -1491,6 +1492,8 @@ _gtk_source_style_scheme_new_from_file (const gchar *filename)
 
        g_return_val_if_fail (filename != NULL, NULL);
 
+       GTK_SOURCE_PROFILER_BEGIN_MARK
+
        if (!g_file_get_contents (filename, &text, &text_len, &error))
        {
                gchar *filename_utf8 = g_filename_display_name (filename);
@@ -1547,6 +1550,8 @@ _gtk_source_style_scheme_new_from_file (const gchar *filename)
        xmlFreeDoc (doc);
        g_free (text);
 
+       GTK_SOURCE_PROFILER_END_MARK ("StyleScheme.new", filename);
+
        return scheme;
 }
 
diff --git a/gtksourceview/gtksourcestyleschememanager.c b/gtksourceview/gtksourcestyleschememanager.c
index 808dbd28..4c98d9b4 100644
--- a/gtksourceview/gtksourcestyleschememanager.c
+++ b/gtksourceview/gtksourcestyleschememanager.c
@@ -24,6 +24,7 @@
 #include "gtksourcestyleschememanager-private.h"
 #include "gtksourcestylescheme-private.h"
 #include "gtksourceutils-private.h"
+#include "gtksourcetrace.h"
 
 /**
  * GtkSourceStyleSchemeManager:
@@ -344,6 +345,8 @@ reload_if_needed (GtkSourceStyleSchemeManager *mgr)
        if (!mgr->need_reload)
                return;
 
+       GTK_SOURCE_PROFILER_BEGIN_MARK
+
        schemes_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
 
        files = _gtk_source_utils_get_file_list ((gchar **)gtk_source_style_scheme_manager_get_search_path 
(mgr),
@@ -389,6 +392,8 @@ reload_if_needed (GtkSourceStyleSchemeManager *mgr)
 
        mgr->ids = schemes_list_to_ids (schemes);
        g_slist_free (schemes);
+
+       GTK_SOURCE_PROFILER_END_MARK ("StyleSchemeManager", "reload");
 }
 
 static void


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