summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-14 13:38:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-14 13:38:27 +0000
commit03f3ae3e31d1b9e27830f29b388b2f3beb47aa06 (patch)
treeb4235ccb5fe7935648cc7dc1ffb1150c44197195
parentd212dc2bf89ec79a85fed3e368d171edd77aa7be (diff)
downloadrspamd-03f3ae3e31d1b9e27830f29b388b2f3beb47aa06.tar.gz
rspamd-03f3ae3e31d1b9e27830f29b388b2f3beb47aa06.zip
Print more info about radix tries
-rw-r--r--src/libutil/map.c4
-rw-r--r--src/libutil/radix.c10
-rw-r--r--src/libutil/radix.h7
3 files changed, 19 insertions, 2 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c
index ea5f3f210..7d21e2f26 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -957,7 +957,7 @@ rspamd_radix_fin (rspamd_mempool_t * pool, struct map_cb_data *data)
radix_destroy_compressed (data->prev_data);
}
if (data->cur_data) {
- msg_info_pool ("read radix trie of %z elements", radix_get_size
- (data->cur_data));
+ msg_info_pool ("read radix trie of %z elements: %s",
+ radix_get_size (data->cur_data), radix_get_info (data->cur_data));
}
}
diff --git a/src/libutil/radix.c b/src/libutil/radix.c
index a8bf5e3d3..7dc0b8237 100644
--- a/src/libutil/radix.c
+++ b/src/libutil/radix.c
@@ -242,3 +242,13 @@ radix_get_pool (radix_compressed_t *tree)
return NULL;
}
+
+const gchar *
+radix_get_info (radix_compressed_t *tree)
+{
+ if (tree == NULL) {
+ return NULL;
+ }
+
+ return btrie_stats (tree->tree);
+}
diff --git a/src/libutil/radix.h b/src/libutil/radix.h
index b2c4ed44f..41309fe72 100644
--- a/src/libutil/radix.h
+++ b/src/libutil/radix.h
@@ -96,6 +96,13 @@ gboolean radix_add_generic_iplist (const gchar *ip_list,
gsize radix_get_size (radix_compressed_t *tree);
/**
+ * Return string that describes this radix tree (memory, nodes, compression etc)
+ * @param tree
+ * @return constant string
+ */
+const gchar * radix_get_info (radix_compressed_t *tree);
+
+/**
* Returns memory pool associated with the radix tree
*/
rspamd_mempool_t* radix_get_pool (radix_compressed_t *tree);