[gedit/wip/spell-checking: 2/2] auto-spell: add check_region() timing debug information



commit f98cac222fa038fc4c2098ed4deca000e8edb6b7
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Jul 21 10:24:20 2015 +0200

    auto-spell: add check_region() timing debug information

 plugins/spell/gedit-automatic-spell-checker.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/plugins/spell/gedit-automatic-spell-checker.c b/plugins/spell/gedit-automatic-spell-checker.c
index 0783973..abdf688 100644
--- a/plugins/spell/gedit-automatic-spell-checker.c
+++ b/plugins/spell/gedit-automatic-spell-checker.c
@@ -55,6 +55,8 @@ enum
        PROP_SPELL_CHECKER,
 };
 
+#define ENABLE_DEBUG 0
+
 #define AUTOMATIC_SPELL_CHECKER_KEY    "GeditAutomaticSpellCheckerID"
 #define SUGGESTION_KEY                 "GeditAutoSuggestionID"
 
@@ -178,12 +180,19 @@ static void
 check_region (GeditAutomaticSpellChecker *spell)
 {
        GtkTextRegionIterator region_iter;
+#if ENABLE_DEBUG
+       GTimer *timer;
+#endif
 
        if (spell->scan_region == NULL)
        {
                return;
        }
 
+#if ENABLE_DEBUG
+       timer = g_timer_new ();
+#endif
+
        gtk_text_region_get_iterator (spell->scan_region, &region_iter, 0);
 
        while (!gtk_text_region_iterator_is_end (&region_iter))
@@ -200,6 +209,14 @@ check_region (GeditAutomaticSpellChecker *spell)
 
        gtk_text_region_destroy (spell->scan_region);
        spell->scan_region = NULL;
+
+#if ENABLE_DEBUG
+       g_print ("%s() executed in %lf seconds\n",
+                G_STRFUNC,
+                g_timer_elapsed (timer, NULL));
+
+       g_timer_destroy (timer);
+#endif
 }
 
 static gboolean


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