Download raw body.
bgpd: use adjout_prefix_size stat for the memory use of the adj-rib-out
bgpd: use adjout_prefix_size stat for the memory use of the adj-rib-out
On Wed, Dec 24, 2025 at 01:19:37PM +0100, Claudio Jeker wrote:
> Use adjout_prefix_size for the amount of memory used by adj-rib-out
> prefixes.
>
> --
> :wq Claudio
>
> Index: output.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpctl/output.c,v
> diff -u -p -r1.65 output.c
> --- output.c 10 Dec 2025 12:37:52 -0000 1.65
> +++ output.c 24 Dec 2025 12:17:35 -0000
> @@ -1069,9 +1069,9 @@ show_rib_mem(struct rde_memstats *stats)
> printf("%10lld prefix entries using %s of memory\n",
> stats->prefix_cnt, fmt_mem(stats->prefix_cnt *
> sizeof(struct prefix)));
> - printf("%10lld adjout_prefix entries using %s of memory\n",
> + printf("%10lld adjout_prefix entries using %s out of %s memory\n",
> stats->adjout_prefix_cnt, fmt_mem(stats->adjout_prefix_cnt *
> - sizeof(struct adjout_prefix)));
> + sizeof(struct adjout_prefix)), fmt_mem(stats->adjout_prefix_size));
fmt_mem writes to a static buffer, so you can't use it twice in the same
printf call. Probably easiest to use two printf calls.
With that fixed, ok tb
> printf("%10lld adjout attribute entries using %s of memory\n",
> stats->adjout_attr_cnt, fmt_mem(stats->adjout_attr_cnt *
> sizeof(struct adjout_attr)));
> Index: output_json.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpctl/output_json.c,v
> diff -u -p -r1.56 output_json.c
> --- output_json.c 10 Dec 2025 12:37:52 -0000 1.56
> +++ output_json.c 24 Dec 2025 12:17:35 -0000
> @@ -904,8 +904,7 @@ json_rib_mem(struct rde_memstats *stats)
> json_rib_mem_element("prefix", stats->prefix_cnt,
> stats->prefix_cnt * sizeof(struct prefix), UINT64_MAX);
> json_rib_mem_element("adjout_prefix", stats->adjout_prefix_cnt,
> - stats->adjout_prefix_cnt * sizeof(struct adjout_prefix),
> - UINT64_MAX);
> + stats->adjout_prefix_size, UINT64_MAX);
> json_rib_mem_element("adjout_attr", stats->adjout_attr_cnt,
> stats->adjout_attr_cnt * sizeof(struct adjout_attr),
> stats->adjout_attr_refs);
> Index: output_ometric.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpctl/output_ometric.c,v
> diff -u -p -r1.20 output_ometric.c
> --- output_ometric.c 10 Dec 2025 12:37:52 -0000 1.20
> +++ output_ometric.c 24 Dec 2025 12:17:35 -0000
> @@ -294,8 +294,7 @@ ometric_rib_mem(struct rde_memstats *sta
> ometric_rib_mem_element("prefix", stats->prefix_cnt,
> stats->prefix_cnt * sizeof(struct prefix), UINT64_MAX);
> ometric_rib_mem_element("adjout_prefix", stats->adjout_prefix_cnt,
> - stats->adjout_prefix_cnt * sizeof(struct adjout_prefix),
> - UINT64_MAX);
> + stats->adjout_prefix_size, UINT64_MAX);
> ometric_rib_mem_element("pend_attr", stats->pend_attr_cnt,
> stats->pend_attr_cnt * sizeof(struct pend_attr), UINT64_MAX);
> ometric_rib_mem_element("pend_prefix", stats->pend_prefix_cnt,
>
bgpd: use adjout_prefix_size stat for the memory use of the adj-rib-out
bgpd: use adjout_prefix_size stat for the memory use of the adj-rib-out