diff options
author | Neale Ranns <nranns@cisco.com> | 2016-10-02 21:20:15 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-10-03 19:15:01 +0000 |
commit | 6c3ebcc2bfd36a5835a99225ad667e4403293ffb (patch) | |
tree | 2ffe666ec31629b3580c1cc51d166d17a15340d8 /vnet/vnet/adj/adj_nbr.c | |
parent | 5499b1968e1d12b736dd3e30b8fb2b69a300128f (diff) |
FIB Memory Usage Diagnostics
add two new CLI commands:
show fib memory
show dpo memory
to display the memory usage of the FIB and DPO object types respectively.
Change-Id: I759e149a0b6fbb58d59c139362221dc33531cffa
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'vnet/vnet/adj/adj_nbr.c')
-rw-r--r-- | vnet/vnet/adj/adj_nbr.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/vnet/vnet/adj/adj_nbr.c b/vnet/vnet/adj/adj_nbr.c index 0913cfd791c..23e40a6850c 100644 --- a/vnet/vnet/adj/adj_nbr.c +++ b/vnet/vnet/adj/adj_nbr.c @@ -275,7 +275,7 @@ adj_nbr_alloc (fib_protocol_t nh_proto, adj_nbr_insert(nh_proto, link_type, nh_addr, sw_if_index, - adj->heap_handle); + adj_get_index(adj)); /* * since we just added the ADJ we have no rewrite string for it, @@ -362,9 +362,9 @@ adj_nbr_add_or_lock (fib_protocol_t nh_proto, adj = adj_get(adj_index); } - adj_lock(adj->heap_handle); + adj_lock(adj_get_index(adj)); - return (adj->heap_handle); + return (adj_get_index(adj)); } adj_index_t @@ -389,10 +389,10 @@ adj_nbr_add_or_lock_w_rewrite (fib_protocol_t nh_proto, adj = adj_get(adj_index); } - adj_lock(adj->heap_handle); - adj_nbr_update_rewrite(adj->heap_handle, rewrite); + adj_lock(adj_get_index(adj)); + adj_nbr_update_rewrite(adj_get_index(adj), rewrite); - return (adj->heap_handle); + return (adj_get_index(adj)); } /** @@ -760,10 +760,20 @@ adj_dpo_unlock (dpo_id_t *dpo) adj_unlock(dpo->dpoi_index); } +static void +adj_mem_show (void) +{ + fib_show_memory_usage("Adjacency", + pool_elts(adj_pool), + pool_len(adj_pool), + sizeof(ip_adjacency_t)); +} + const static dpo_vft_t adj_nbr_dpo_vft = { .dv_lock = adj_dpo_lock, .dv_unlock = adj_dpo_unlock, .dv_format = format_adj_nbr, + .dv_mem_show = adj_mem_show, }; const static dpo_vft_t adj_nbr_incompl_dpo_vft = { .dv_lock = adj_dpo_lock, |