From: Igor Putovny Date: Wed, 10 Jul 2024 10:41:18 +0000 (+0200) Subject: Add counters of nodes with assigned bucket X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e23d296a14b5ede549981c06968bed505d12ef0e;p=thirdparty%2Fbird.git Add counters of nodes with assigned bucket --- diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index efd78104c..46335a07a 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -710,6 +710,7 @@ collect_prefixes_ip4_helper(struct aggregator_proto *p, struct net_addr_ip4 *add assert(node->bucket != NULL); create_route_ip4(p, node->bucket, addr); *count += 1; + p->leaves++; return; } @@ -718,6 +719,7 @@ collect_prefixes_ip4_helper(struct aggregator_proto *p, struct net_addr_ip4 *add { create_route_ip4(p, node->bucket, addr); *count += 1; + p->internal_nodes++; } if (node->child[0]) @@ -746,6 +748,7 @@ collect_prefixes_ip6_helper(struct aggregator_proto *p, struct net_addr_ip6 *add assert(node->bucket != NULL); create_route_ip6(p, node->bucket, addr); *count += 1; + p->leaves++; return; } @@ -754,6 +757,7 @@ collect_prefixes_ip6_helper(struct aggregator_proto *p, struct net_addr_ip6 *add { create_route_ip6(p, node->bucket, addr); *count += 1; + p->internal_nodes++; } if (node->child[0]) @@ -863,6 +867,8 @@ run_aggregation(struct aggregator_proto *p) log("%d prefixes before aggregation", p->before_count); log("%d prefixes after aggregation", p->after_count); + log("%d internal nodes with bucket", p->internal_nodes); + log("%d leaves with bucket", p->leaves); log("==== AGGREGATION DONE ===="); } @@ -906,6 +912,8 @@ aggregate_on_feed_end(struct channel *C) p->root = NULL; p->before_count = 0; p->after_count = 0; + p->internal_nodes = 0; + p->leaves = 0; if (p->first_run) p->first_run = 0; @@ -1678,6 +1686,8 @@ aggregator_cleanup(struct proto *P) p->before_count = 0; p->after_count = 0; + p->internal_nodes = 0; + p->leaves = 0; } static int diff --git a/proto/aggregator/aggregator.h b/proto/aggregator/aggregator.h index edc17b562..6e9978c4a 100644 --- a/proto/aggregator/aggregator.h +++ b/proto/aggregator/aggregator.h @@ -81,6 +81,8 @@ struct aggregator_proto { struct settle notify_settle; int before_count; int after_count; + int internal_nodes; + int leaves; }; enum aggr_item_type {