bgpd: add some counters not displayed yet

Add some counters to keep track how often stuff is done.
This is mainly for us developers.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2023-11-03 23:26:56 -04:00
parent e2090bf4c6
commit 1115feedc3
2 changed files with 13 additions and 1 deletions

View File

@ -745,6 +745,8 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
struct bgp_path_info *bpi_ultimate;
struct peer *peer_new, *peer_exist;
bgp->bestpath_runs++;
*paths_eq = 0;
/* 0. Null check. */
@ -4119,8 +4121,10 @@ static void bgp_process_internal(struct bgp *bgp, struct bgp_dest *dest,
}
/* already scheduled for processing? */
if (CHECK_FLAG(dest->flags, BGP_NODE_PROCESS_SCHEDULED))
if (CHECK_FLAG(dest->flags, BGP_NODE_PROCESS_SCHEDULED)) {
bgp->node_already_on_queue++;
return;
}
/* If the flag BGP_NODE_SELECT_DEFER is set, do not add route to
* the workqueue
@ -4129,6 +4133,7 @@ static void bgp_process_internal(struct bgp *bgp, struct bgp_dest *dest,
if (BGP_DEBUG(update, UPDATE_OUT))
zlog_debug("BGP_NODE_SELECT_DEFER set for route %p",
dest);
bgp->node_deferred_on_queue++;
return;
}
@ -13095,6 +13100,9 @@ DEFUN(show_ip_bgp_afi_safi_statistics, show_ip_bgp_afi_safi_statistics_cmd,
json = json_object_new_object();
json_object_object_add(json, get_afi_safi_str(afi, safi, true),
json_afi_safi);
json_object_int_add(json, "bgpBestPathCalls", bgp->bestpath_runs);
json_object_int_add(json, "bgpNodeOnQueue", bgp->node_already_on_queue);
json_object_int_add(json, "bgpNodeDeferredOnQueue", bgp->node_deferred_on_queue);
vty_json(vty, json);
}
return ret;

View File

@ -864,6 +864,10 @@ struct bgp {
/* BGP route flap dampening configuration */
struct bgp_damp_config damp[AFI_MAX][SAFI_MAX];
uint64_t bestpath_runs;
uint64_t node_already_on_queue;
uint64_t node_deferred_on_queue;
QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(bgp);