[gnumeric] Lookup: add debug for caches.



commit 639485d98a6e81ce71dffbeb6a29872bffe03658
Author: Morten Welinder <terra gnome org>
Date:   Thu Mar 29 13:22:08 2012 -0400

    Lookup: add debug for caches.

 plugins/fn-lookup/ChangeLog   |    4 ++++
 plugins/fn-lookup/functions.c |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/fn-lookup/ChangeLog b/plugins/fn-lookup/ChangeLog
index f58fc8e..d995e1c 100644
--- a/plugins/fn-lookup/ChangeLog
+++ b/plugins/fn-lookup/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-29  Morten Welinder  <terra gnome org>
+
+	* functions.c (clear_caches): Add debug flag.
+
 2012-03-18  Morten Welinder  <terra gnome org>
 
 	* functions.c (gnumeric_vlookup, gnumeric_hlookup): Handle string
diff --git a/plugins/fn-lookup/functions.c b/plugins/fn-lookup/functions.c
index fa41905..c207d30 100644
--- a/plugins/fn-lookup/functions.c
+++ b/plugins/fn-lookup/functions.c
@@ -101,6 +101,7 @@ bisection_compare_float (const void *a_, const void *b_)
 
 /* -------------------------------------------------------------------------- */
 
+static gboolean debug_lookup_caches;
 static GStringChunk *lookup_string_pool;
 static GOMemChunk *lookup_float_pool;
 static GHashTable *linear_hlookup_string_cache;
@@ -123,6 +124,9 @@ clear_caches (void)
 	if (!lookup_string_pool)
 		return;
 
+	if (debug_lookup_caches)
+		g_printerr ("Clearing lookup caches [%ld]\n", total_cache_size);
+
 	total_cache_size = 0;
 
 	/* ---------- */
@@ -1905,6 +1909,7 @@ GnmFuncDescriptor const lookup_functions[] = {
 G_MODULE_EXPORT void
 go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
 {
+	debug_lookup_caches = gnm_debug_flag ("lookup");
 	g_signal_connect (gnm_app_get_app (), "recalc-clear-caches",
 			  G_CALLBACK (clear_caches), NULL);
 }



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