diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2019-11-29 15:22:03 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2019-11-29 15:22:03 +0000 |
commit | 743cd8c716fde937bd56e9869ffc8db826879370 (patch) | |
tree | b9342018403bb3608b3dba6de6da26330cbba3da /sbin/unwind | |
parent | 8d83034c2996c480de594b7083ca2fe8396cf616 (diff) |
While we learn how the "decaying" histogram works it's helpful to show
it in unwindctl status output next to the all time histogram.
Diffstat (limited to 'sbin/unwind')
-rw-r--r-- | sbin/unwind/frontend.c | 3 | ||||
-rw-r--r-- | sbin/unwind/resolver.c | 20 | ||||
-rw-r--r-- | sbin/unwind/unwind.h | 3 |
3 files changed, 13 insertions, 13 deletions
diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c index d02f7e61f88..4845359a9f5 100644 --- a/sbin/unwind/frontend.c +++ b/sbin/unwind/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.40 2019/11/27 17:09:12 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.41 2019/11/29 15:22:02 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -487,6 +487,7 @@ frontend_dispatch_resolver(int fd, short event, void *bula) case IMSG_CTL_RESOLVER_INFO: case IMSG_CTL_RESOLVER_WHY_BOGUS: case IMSG_CTL_RESOLVER_HISTOGRAM: + case IMSG_CTL_RESOLVER_DECAYING_HISTOGRAM: case IMSG_CTL_AUTOCONF_RESOLVER_INFO: case IMSG_CTL_END: control_imsg_relay(&imsg); diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c index a06e30bc845..4eb968f01fc 100644 --- a/sbin/unwind/resolver.c +++ b/sbin/unwind/resolver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolver.c,v 1.83 2019/11/28 20:28:13 otto Exp $ */ +/* $OpenBSD: resolver.c,v 1.84 2019/11/29 15:22:02 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -170,8 +170,6 @@ void show_status(enum uw_resolver_type, pid_t); void send_resolver_info(struct uw_resolver *, pid_t); void send_detailed_resolver_info(struct uw_resolver *, pid_t); -void send_resolver_histogram_info(struct uw_resolver *, - pid_t); void trust_anchor_resolve(void); void trust_anchor_timo(int, short, void *); void trust_anchor_resolve_done(struct uw_resolver *, void *, @@ -1710,6 +1708,8 @@ send_resolver_info(struct uw_resolver *res, pid_t pid) void send_detailed_resolver_info(struct uw_resolver *res, pid_t pid) { + int64_t histogram[nitems(histogram_limits)]; + size_t i; char buf[1024]; if (res == NULL) @@ -1720,18 +1720,16 @@ send_detailed_resolver_info(struct uw_resolver *res, pid_t pid) resolver_imsg_compose_frontend(IMSG_CTL_RESOLVER_WHY_BOGUS, pid, buf, sizeof(buf)); } - send_resolver_histogram_info(res, pid); -} - -void -send_resolver_histogram_info(struct uw_resolver *res, pid_t pid) -{ - int64_t histogram[nitems(histogram_limits)]; memcpy(histogram, res->histogram, sizeof(histogram)); - resolver_imsg_compose_frontend(IMSG_CTL_RESOLVER_HISTOGRAM, pid, histogram, sizeof(histogram)); + + memcpy(histogram, res->latest_histogram, sizeof(histogram)); + for (i = 0; i < nitems(histogram_limits); i++) + histogram[i] /= 1000; + resolver_imsg_compose_frontend(IMSG_CTL_RESOLVER_DECAYING_HISTOGRAM, + pid, histogram, sizeof(histogram)); } void diff --git a/sbin/unwind/unwind.h b/sbin/unwind/unwind.h index 339fc8e03a4..43277a7b521 100644 --- a/sbin/unwind/unwind.h +++ b/sbin/unwind/unwind.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unwind.h,v 1.39 2019/11/28 10:02:44 florian Exp $ */ +/* $OpenBSD: unwind.h,v 1.40 2019/11/29 15:22:02 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -102,6 +102,7 @@ enum imsg_type { IMSG_CTL_RESOLVER_INFO, IMSG_CTL_RESOLVER_WHY_BOGUS, IMSG_CTL_RESOLVER_HISTOGRAM, + IMSG_CTL_RESOLVER_DECAYING_HISTOGRAM, IMSG_CTL_AUTOCONF_RESOLVER_INFO, IMSG_CTL_END, IMSG_HTTPSOCK, |