0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

Add counters of nodes with assigned bucket

This commit is contained in:
Igor Putovny 2024-07-10 12:41:18 +02:00
parent 3b93920fda
commit e23d296a14
2 changed files with 12 additions and 0 deletions

View File

@ -710,6 +710,7 @@ collect_prefixes_ip4_helper(struct aggregator_proto *p, struct net_addr_ip4 *add
assert(node->bucket != NULL); assert(node->bucket != NULL);
create_route_ip4(p, node->bucket, addr); create_route_ip4(p, node->bucket, addr);
*count += 1; *count += 1;
p->leaves++;
return; 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); create_route_ip4(p, node->bucket, addr);
*count += 1; *count += 1;
p->internal_nodes++;
} }
if (node->child[0]) 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); assert(node->bucket != NULL);
create_route_ip6(p, node->bucket, addr); create_route_ip6(p, node->bucket, addr);
*count += 1; *count += 1;
p->leaves++;
return; 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); create_route_ip6(p, node->bucket, addr);
*count += 1; *count += 1;
p->internal_nodes++;
} }
if (node->child[0]) 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 before aggregation", p->before_count);
log("%d prefixes after aggregation", p->after_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 ===="); log("==== AGGREGATION DONE ====");
} }
@ -906,6 +912,8 @@ aggregate_on_feed_end(struct channel *C)
p->root = NULL; p->root = NULL;
p->before_count = 0; p->before_count = 0;
p->after_count = 0; p->after_count = 0;
p->internal_nodes = 0;
p->leaves = 0;
if (p->first_run) if (p->first_run)
p->first_run = 0; p->first_run = 0;
@ -1678,6 +1686,8 @@ aggregator_cleanup(struct proto *P)
p->before_count = 0; p->before_count = 0;
p->after_count = 0; p->after_count = 0;
p->internal_nodes = 0;
p->leaves = 0;
} }
static int static int

View File

@ -81,6 +81,8 @@ struct aggregator_proto {
struct settle notify_settle; struct settle notify_settle;
int before_count; int before_count;
int after_count; int after_count;
int internal_nodes;
int leaves;
}; };
enum aggr_item_type { enum aggr_item_type {