summaryrefslogtreecommitdiff
path: root/sbin/sysctl
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2019-07-12 00:05:00 +0000
committercheloha <cheloha@cvs.openbsd.org>2019-07-12 00:05:00 +0000
commit52c0cba87623c7b036a584ff656fcb55c1866e4f (patch)
tree9e4971282ce981f06fd4b17af01234dc6c314344 /sbin/sysctl
parent164b2a5660b86c080db08864dd8b774a49b6401b (diff)
sysctl(2): add KERN_TIMEOUT_STATS: timeout(9) status and statistics.
With these totals one can track the throughput of the timeout(9) layer from userspace. With input from mpi@. ok mpi@
Diffstat (limited to 'sbin/sysctl')
-rw-r--r--sbin/sysctl/sysctl.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 4fdf53b706b..42a2846cd66 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.245 2019/07/03 10:32:33 dlg Exp $ */
+/* $OpenBSD: sysctl.c,v 1.246 2019/07/12 00:04:59 cheloha Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -183,6 +183,7 @@ time_t boottime;
#define SENSORS 0x00002000
#define SMALLBUF 0x00004000
#define HEX 0x00008000
+#define TIMEOUT 0x00010000
/* prototypes */
void debuginit(void);
@@ -527,6 +528,9 @@ parse(char *string, int flags)
return;
warnx("use pfctl to view %s information", string);
return;
+ case KERN_TIMEOUT_STATS:
+ special |= TIMEOUT;
+ break;
}
break;
@@ -1027,6 +1031,23 @@ parse(char *string, int flags)
}
return;
}
+ if (special & TIMEOUT) {
+ struct timeoutstat *tstat = (struct timeoutstat *)buf;
+
+ if (!nflag)
+ printf("%s%s", string, equ);
+ printf("added = %llu, cancelled = %llu, deleted = %llu, "
+ "late = %llu, pending = %llu, readded = %llu, "
+ "rescheduled = %llu, run_softclock = %llu, "
+ "run_thread = %llu, softclocks = %llu, "
+ "thread_wakeups = %llu\n",
+ tstat->tos_added, tstat->tos_cancelled, tstat->tos_deleted,
+ tstat->tos_late, tstat->tos_pending, tstat->tos_readded,
+ tstat->tos_rescheduled, tstat->tos_run_softclock,
+ tstat->tos_run_thread, tstat->tos_softclocks,
+ tstat->tos_thread_wakeups);
+ return;
+ }
switch (type) {
case CTLTYPE_INT:
if (newsize == 0) {