1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Fixes protocol statistics for pipes.

This commit is contained in:
Ondrej Zajicek
2010-02-13 10:44:46 +01:00
parent c83876265e
commit 9db74169be
4 changed files with 108 additions and 35 deletions

View File

@@ -791,6 +791,67 @@ proto_state_name(struct proto *p)
#undef P
}
static void
proto_do_show_stats(struct proto *p)
{
struct proto_stats *s = &p->stats;
cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred",
s->imp_routes, s->exp_routes, s->pref_routes);
cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted");
cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u",
s->imp_updates_received, s->imp_updates_invalid,
s->imp_updates_filtered, s->imp_updates_ignored,
s->imp_updates_accepted);
cli_msg(-1006, " Import withdraws: %10u %10u --- %10u %10u",
s->imp_withdraws_received, s->imp_withdraws_invalid,
s->imp_withdraws_ignored, s->imp_withdraws_accepted);
cli_msg(-1006, " Export updates: %10u %10u %10u --- %10u",
s->exp_updates_received, s->exp_updates_rejected,
s->exp_updates_filtered, s->exp_updates_accepted);
cli_msg(-1006, " Export withdraws: %10u --- --- --- %10u",
s->exp_withdraws_received, s->exp_withdraws_accepted);
}
static void
proto_do_show_pipe_stats(struct proto *p)
{
struct proto_stats *s1 = &p->stats;
struct proto_stats *s2 = pipe_get_peer_stats(p);
/*
* Pipe stats (as anything related to pipes) are a bit tricky. There
* are two sets of stats - s1 for routes going from the primary
* routing table to the secondary routing table ('exported' from the
* user point of view) and s2 for routes going in the other
* direction ('imported' from the user point of view).
*
* Each route going through a pipe is, technically, first exported
* to the pipe and then imported from that pipe and such operations
* are counted in one set of stats according to the direction of the
* route propagation. Filtering is done just in the first part
* (export). Therefore, we compose stats for one directon for one
* user direction from both import and export stats, skipping
* immediate and irrelevant steps (exp_updates_accepted,
* imp_updates_received, imp_updates_filtered, ...)
*/
cli_msg(-1006, " Routes: %u imported, %u exported",
s2->imp_routes, s1->imp_routes);
cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted");
cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u",
s2->exp_updates_received, s2->exp_updates_rejected + s2->imp_updates_invalid,
s2->exp_updates_filtered, s2->imp_updates_ignored, s2->imp_updates_accepted);
cli_msg(-1006, " Import withdraws: %10u %10u --- %10u %10u",
s2->exp_withdraws_received, s2->imp_withdraws_invalid,
s2->imp_withdraws_ignored, s2->imp_withdraws_accepted);
cli_msg(-1006, " Export updates: %10u %10u %10u %10u %10u",
s1->exp_updates_received, s1->exp_updates_rejected + s1->imp_updates_invalid,
s1->exp_updates_filtered, s1->imp_updates_ignored, s1->imp_updates_accepted);
cli_msg(-1006, " Export withdraws: %10u %10u --- %10u %10u",
s1->exp_withdraws_received, s1->imp_withdraws_invalid,
s1->imp_withdraws_ignored, s1->imp_withdraws_accepted);
}
static void
proto_do_show(struct proto *p, int verbose)
{
@@ -817,21 +878,12 @@ proto_do_show(struct proto *p, int verbose)
if (p->proto_state != PS_DOWN)
{
cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred",
p->stats.imp_routes, p->stats.exp_routes, p->stats.pref_routes);
cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted");
cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u",
p->stats.imp_updates_received, p->stats.imp_updates_invalid,
p->stats.imp_updates_filtered, p->stats.imp_updates_ignored,
p->stats.imp_updates_accepted);
cli_msg(-1006, " Import withdraws: %10u %10u --- %10u %10u",
p->stats.imp_withdraws_received, p->stats.imp_withdraws_invalid,
p->stats.imp_withdraws_ignored, p->stats.imp_withdraws_accepted);
cli_msg(-1006, " Export updates: %10u %10u %10u --- %10u",
p->stats.exp_updates_received, p->stats.exp_updates_rejected,
p->stats.exp_updates_filtered, p->stats.exp_updates_accepted);
cli_msg(-1006, " Export withdraws: %10u --- --- --- %10u",
p->stats.exp_withdraws_received, p->stats.exp_withdraws_accepted);
#ifdef CONFIG_PIPE
if (proto_is_pipe(p))
proto_do_show_pipe_stats(p);
else
#endif
proto_do_show_stats(p);
}
cli_msg(-1006, "");