Skip to content

Commit 1115fee

Browse files
committed
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 <[email protected]>
1 parent e2090bf commit 1115fee

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

bgpd/bgp_route.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
745745
struct bgp_path_info *bpi_ultimate;
746746
struct peer *peer_new, *peer_exist;
747747

748+
bgp->bestpath_runs++;
749+
748750
*paths_eq = 0;
749751

750752
/* 0. Null check. */
@@ -4119,8 +4121,10 @@ static void bgp_process_internal(struct bgp *bgp, struct bgp_dest *dest,
41194121
}
41204122

41214123
/* already scheduled for processing? */
4122-
if (CHECK_FLAG(dest->flags, BGP_NODE_PROCESS_SCHEDULED))
4124+
if (CHECK_FLAG(dest->flags, BGP_NODE_PROCESS_SCHEDULED)) {
4125+
bgp->node_already_on_queue++;
41234126
return;
4127+
}
41244128

41254129
/* If the flag BGP_NODE_SELECT_DEFER is set, do not add route to
41264130
* the workqueue
@@ -4129,6 +4133,7 @@ static void bgp_process_internal(struct bgp *bgp, struct bgp_dest *dest,
41294133
if (BGP_DEBUG(update, UPDATE_OUT))
41304134
zlog_debug("BGP_NODE_SELECT_DEFER set for route %p",
41314135
dest);
4136+
bgp->node_deferred_on_queue++;
41324137
return;
41334138
}
41344139

@@ -13095,6 +13100,9 @@ DEFUN(show_ip_bgp_afi_safi_statistics, show_ip_bgp_afi_safi_statistics_cmd,
1309513100
json = json_object_new_object();
1309613101
json_object_object_add(json, get_afi_safi_str(afi, safi, true),
1309713102
json_afi_safi);
13103+
json_object_int_add(json, "bgpBestPathCalls", bgp->bestpath_runs);
13104+
json_object_int_add(json, "bgpNodeOnQueue", bgp->node_already_on_queue);
13105+
json_object_int_add(json, "bgpNodeDeferredOnQueue", bgp->node_deferred_on_queue);
1309813106
vty_json(vty, json);
1309913107
}
1310013108
return ret;

bgpd/bgpd.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,10 @@ struct bgp {
864864
/* BGP route flap dampening configuration */
865865
struct bgp_damp_config damp[AFI_MAX][SAFI_MAX];
866866

867+
uint64_t bestpath_runs;
868+
uint64_t node_already_on_queue;
869+
uint64_t node_deferred_on_queue;
870+
867871
QOBJ_FIELDS;
868872
};
869873
DECLARE_QOBJ_TYPE(bgp);

0 commit comments

Comments
 (0)