From: claudio Date: Wed, 31 Aug 2022 15:00:53 +0000 (+0000) Subject: Remove the hash statistics print code. The RDE no longer sends these X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=374adf67807ba38cf6f70b13bed3b6c3eb7028cf;p=openbsd Remove the hash statistics print code. The RDE no longer sends these imsgs. OK tb@ --- diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index fbdf53e2887..04cae4fa205 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $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 @@ -410,7 +410,6 @@ show(struct imsg *imsg, struct parse_result *res) 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; @@ -478,13 +477,7 @@ show(struct imsg *imsg, struct parse_result *res) 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"); diff --git a/usr.sbin/bgpctl/bgpctl.h b/usr.sbin/bgpctl/bgpctl.h index dce33b7bd8b..66a0f145809 100644 --- a/usr.sbin/bgpctl/bgpctl.h +++ b/usr.sbin/bgpctl/bgpctl.h @@ -1,4 +1,4 @@ -/* $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 @@ -30,7 +30,6 @@ struct output { 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 *); diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c index 5483584a2b6..04b9cc2c27e 100644 --- a/usr.sbin/bgpctl/output.c +++ b/usr.sbin/bgpctl/output.c @@ -1,4 +1,4 @@ -/* $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 @@ -1030,20 +1030,6 @@ show_rib_mem(struct rde_memstats *stats) 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 @@ -1131,7 +1117,6 @@ const struct output show_output = { .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, diff --git a/usr.sbin/bgpctl/output_json.c b/usr.sbin/bgpctl/output_json.c index 3ed9f941e80..dfd443d55a5 100644 --- a/usr.sbin/bgpctl/output_json.c +++ b/usr.sbin/bgpctl/output_json.c @@ -1,4 +1,4 @@ -/* $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 @@ -965,28 +965,6 @@ json_rib_mem(struct rde_memstats *stats) 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) { @@ -1076,7 +1054,6 @@ const struct output json_output = { .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,