]> source.dussan.org Git - rspamd.git/commitdiff
Print more info about radix tries
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 14 Feb 2016 13:38:27 +0000 (13:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 14 Feb 2016 13:38:27 +0000 (13:38 +0000)
src/libutil/map.c
src/libutil/radix.c
src/libutil/radix.h

index ea5f3f2101ca8772410b83e385d1b91c0421a681..7d21e2f26c724f158fe2dffd9341341300630c88 100644 (file)
@@ -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));
        }
 }
index a8bf5e3d393c418cd422b38e7e7db1488141bef5..7dc0b8237da01b8bfec1cfb7d7f0d244f431016a 100644 (file)
@@ -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);
+}
index b2c4ed44f3e79cd4265d65f8df1312118021ddbe..41309fe7297a12a0a62dd88956de91cf52e2c775 100644 (file)
@@ -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
  */