summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2008-05-25 01:44:58 +0000
committerjb <jb@FreeBSD.org>2008-05-25 01:44:58 +0000
commit1c6ecc547ffaa812b2fe49de249c0123b4850038 (patch)
treed7817ab3980cddc07959538e125b84cd7009f965 /sys/kern/sched_ule.c
parent933221c70b19378787045078df471a91ad53325b (diff)
downloadFreeBSD-src-1c6ecc547ffaa812b2fe49de249c0123b4850038.zip
FreeBSD-src-1c6ecc547ffaa812b2fe49de249c0123b4850038.tar.gz
Add the vtime (virtual time) hooks for DTrace.
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r--sys/kern/sched_ule.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 7fe80af..172f41a 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -39,6 +39,7 @@
__FBSDID("$FreeBSD$");
#include "opt_hwpmc_hooks.h"
+#include "opt_kdtrace.h"
#include "opt_sched.h"
#include <sys/param.h>
@@ -69,6 +70,12 @@ __FBSDID("$FreeBSD$");
#include <sys/pmckern.h>
#endif
+#ifdef KDTRACE_HOOKS
+#include <sys/dtrace_bsd.h>
+int dtrace_vtime_active;
+dtrace_vtime_switch_func_t dtrace_vtime_switch_func;
+#endif
+
#include <machine/cpu.h>
#include <machine/smp.h>
@@ -1823,6 +1830,17 @@ sched_switch(struct thread *td, struct thread *newtd, int flags)
#endif
lock_profile_release_lock(&TDQ_LOCKPTR(tdq)->lock_object);
TDQ_LOCKPTR(tdq)->mtx_lock = (uintptr_t)newtd;
+
+#ifdef KDTRACE_HOOKS
+ /*
+ * If DTrace has set the active vtime enum to anything
+ * other than INACTIVE (0), then it should have set the
+ * function to call.
+ */
+ if (dtrace_vtime_active)
+ (*dtrace_vtime_switch_func)(newtd);
+#endif
+
cpu_switch(td, newtd, mtx);
/*
* We may return from cpu_switch on a different cpu. However,
OpenPOWER on IntegriCloud