PERFORCE change 134441 for review
John Birrell
jb at FreeBSD.org
Tue Jan 29 21:11:06 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=134441
Change 134441 by jb at jb_freebsd1 on 2008/01/30 05:10:54
IFdtrace
Affected files ...
.. //depot/projects/dtrace7/src/sys/kern/sched_4bsd.c#3 edit
.. //depot/projects/dtrace7/src/sys/kern/sched_ule.c#3 edit
Differences ...
==== //depot/projects/dtrace7/src/sys/kern/sched_4bsd.c#3 (text+ko) ====
@@ -36,6 +36,7 @@
__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.106.2.1 2007/12/20 07:15:40 davidxu Exp $");
#include "opt_hwpmc_hooks.h"
+#include "opt_kdtrace.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -59,6 +60,12 @@
#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).
@@ -901,6 +908,15 @@
PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
#endif
+#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
/* I feel sleepy */
cpu_switch(td, newtd, td->td_lock);
/*
==== //depot/projects/dtrace7/src/sys/kern/sched_ule.c#3 (text+ko) ====
@@ -39,6 +39,7 @@
__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.214.2.2 2007/12/20 07:15:40 davidxu Exp $");
#include "opt_hwpmc_hooks.h"
+#include "opt_kdtrace.h"
#include "opt_sched.h"
#include <sys/param.h>
@@ -68,6 +69,12 @@
#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>
@@ -1895,6 +1902,16 @@
PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
#endif
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,
More information about the p4-projects
mailing list