summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_4bsd.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_4bsd.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_4bsd.c')
-rw-r--r--sys/kern/sched_4bsd.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index cefe4ac..a5768ec 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include "opt_hwpmc_hooks.h"
#include "opt_sched.h"
+#include "opt_kdtrace.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,6 +62,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
+
/*
* INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in
* the range 100-256 Hz (approximately).
@@ -962,6 +969,16 @@ sched_switch(struct thread *td, struct thread *newtd, int flags)
#endif
/* I feel sleepy */
lock_profile_release_lock(&sched_lock.lock_object);
+#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, td->td_lock);
lock_profile_obtain_lock_success(&sched_lock.lock_object,
0, 0, __FILE__, __LINE__);
OpenPOWER on IntegriCloud