From: Vsevolod Stakhov Date: Sun, 14 Feb 2016 13:38:27 +0000 (+0000) Subject: Print more info about radix tries X-Git-Tag: 1.2.0~240 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03f3ae3e31d1b9e27830f29b388b2f3beb47aa06;p=thirdparty%2Frspamd.git Print more info about radix tries --- diff --git a/src/libutil/map.c b/src/libutil/map.c index ea5f3f2101..7d21e2f26c 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 a8bf5e3d39..7dc0b8237d 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 b2c4ed44f3..41309fe729 100644 --- a/src/libutil/radix.h +++ b/src/libutil/radix.h @@ -95,6 +95,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 */