summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_bsd.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2020-01-21 16:16:22 +0000
committermpi <mpi@openbsd.org>2020-01-21 16:16:22 +0000
commit91b2ecf67e2a667ccefd071f95f44a8068f1bbc4 (patch)
tree4844bb05cf2473deb3060725603f0582ebfa6974 /sys/kern/sched_bsd.c
parentregen (diff)
downloadwireguard-openbsd-91b2ecf67e2a667ccefd071f95f44a8068f1bbc4.tar.xz
wireguard-openbsd-91b2ecf67e2a667ccefd071f95f44a8068f1bbc4.zip
Import dt(4) a driver and framework for Dynamic Profiling.
The design is fairly simple: events, in the form of descriptors on a ring, are being produced in any kernel context and being consumed by a userland process reading /dev/dt. Code and hooks are all guarded under '#if NDT > 0' so this commit shouldn't introduce any change as long as dt(4) is disable in GENERIC. ok kettenis@, visa@, jasper@, deraadt@
Diffstat (limited to 'sys/kern/sched_bsd.c')
-rw-r--r--sys/kern/sched_bsd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 3b8c4a80536..9172bc7e24e 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.60 2019/12/11 07:30:09 guenther Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.61 2020/01/21 16:16:23 mpi Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -48,6 +48,7 @@
#include <sys/sched.h>
#include <sys/timeout.h>
#include <sys/smr.h>
+#include <sys/tracepoint.h>
#ifdef KTRACE
#include <sys/ktrace.h>
@@ -392,8 +393,12 @@ mi_switch(void)
if (p != nextproc) {
uvmexp.swtch++;
+ TRACEPOINT(sched, off__cpu, nextproc->p_tid,
+ nextproc->p_p->ps_pid);
cpu_switchto(p, nextproc);
+ TRACEPOINT(sched, on__cpu, NULL);
} else {
+ TRACEPOINT(sched, remain__cpu, NULL);
p->p_stat = SONPROC;
}