imsgs.
OK tb@
-/* $OpenBSD: bgpctl.c,v 1.282 2022/08/17 15:16:12 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.283 2022/08/31 15:00:53 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
struct ktable *kt;
struct ctl_show_rib rib;
struct rde_memstats stats;
- struct rde_hashstats hash;
u_char *asdata;
u_int rescode, ilen;
size_t aslen;
errx(1, "wrong imsg len");
memcpy(&stats, imsg->data, sizeof(stats));
output->rib_mem(&stats);
- break;
- case IMSG_CTL_SHOW_RIB_HASH:
- if (imsg->hdr.len < IMSG_HEADER_SIZE + sizeof(hash))
- errx(1, "wrong imsg len");
- memcpy(&hash, imsg->data, sizeof(hash));
- output->rib_hash(&hash);
- break;
+ return (1);
case IMSG_CTL_SHOW_SET:
if (imsg->hdr.len < IMSG_HEADER_SIZE + sizeof(set))
errx(1, "wrong imsg len");
-/* $OpenBSD: bgpctl.h,v 1.15 2022/08/31 12:13:59 claudio Exp $ */
+/* $OpenBSD: bgpctl.h,v 1.16 2022/08/31 15:00:53 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
void (*communities)(u_char *, size_t, struct parse_result *);
void (*rib)(struct ctl_show_rib *, u_char *, size_t,
struct parse_result *);
- void (*rib_hash)(struct rde_hashstats *);
void (*rib_mem)(struct rde_memstats *);
void (*set)(struct ctl_show_set *);
void (*rtr)(struct ctl_show_rtr *);
-/* $OpenBSD: output.c,v 1.28 2022/08/29 18:19:21 claudio Exp $ */
+/* $OpenBSD: output.c,v 1.29 2022/08/31 15:00:53 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
stats->attr_data));
printf("Sets using %s of memory\n", fmt_mem(stats->aset_size +
stats->pset_size));
- printf("\nRDE hash statistics\n");
-}
-
-static void
-show_rib_hash(struct rde_hashstats *hash)
-{
- double avg, dev;
-
- printf("\t%s: size %lld, %lld entries\n", hash->name, hash->num,
- hash->sum);
- avg = (double)hash->sum / (double)hash->num;
- dev = sqrt(fmax(0, hash->sumq / hash->num - avg * avg));
- printf("\t min %lld max %lld avg/std-dev = %.3f/%.3f\n",
- hash->min, hash->max, avg, dev);
}
static void
.attr = show_attr,
.rib = show_rib,
.rib_mem = show_rib_mem,
- .rib_hash = show_rib_hash,
.set = show_rib_set,
.rtr = show_rtr,
.result = show_result,
-/* $OpenBSD: output_json.c,v 1.22 2022/08/29 18:19:21 claudio Exp $ */
+/* $OpenBSD: output_json.c,v 1.23 2022/08/31 15:00:53 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
json_do_end();
}
-static void
-json_rib_hash(struct rde_hashstats *hash)
-{
- double avg, dev;
-
- json_do_array("hashtables");
-
- avg = (double)hash->sum / (double)hash->num;
- dev = sqrt(fmax(0, hash->sumq / hash->num - avg * avg));
-
- json_do_object("hashtable");
-
- json_do_printf("name", "%s", hash->name);
- json_do_uint("size", hash->num);
- json_do_uint("entries", hash->sum);
- json_do_uint("min", hash->min);
- json_do_uint("max", hash->max);
- json_do_double("avg", avg);
- json_do_double("std_dev", dev);
- json_do_end();
-}
-
static void
json_rib_set(struct ctl_show_set *set)
{
.attr = json_attr,
.rib = json_rib,
.rib_mem = json_rib_mem,
- .rib_hash = json_rib_hash,
.set = json_rib_set,
.rtr = json_rtr,
.result = json_result,