PERFORCE change 143153 for review
John Birrell
jb at FreeBSD.org
Mon Jun 9 03:05:25 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143153
Change 143153 by jb at freebsd3 on 2008/06/09 03:04:33
Add virtual time support for DTrace.
Affected files ...
.. //depot/projects/dtrace6/src/sys/kern/sched_4bsd.c#2 edit
.. //depot/projects/dtrace6/src/sys/kern/sched_ule.c#2 edit
Differences ...
==== //depot/projects/dtrace6/src/sys/kern/sched_4bsd.c#2 (text+ko) ====
@@ -36,6 +36,7 @@
__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.77.2.1 2006/06/16 22:11:55 jhb Exp $");
#include "opt_hwpmc_hooks.h"
+#include "opt_kdtrace.h"
#define kse td_sched
@@ -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).
@@ -970,6 +977,16 @@
if (PMC_PROC_IS_USING_PMCS(td->td_proc))
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
cpu_switch(td, newtd);
#ifdef HWPMC_HOOKS
if (PMC_PROC_IS_USING_PMCS(td->td_proc))
==== //depot/projects/dtrace6/src/sys/kern/sched_ule.c#2 (text+ko) ====
@@ -28,6 +28,7 @@
__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.153.2.3 2005/09/27 12:00:31 davidxu Exp $");
#include "opt_hwpmc_hooks.h"
+#include "opt_kdtrace.h"
#include "opt_sched.h"
#define kse td_sched
@@ -58,6 +59,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>
@@ -1386,6 +1393,16 @@
if (PMC_PROC_IS_USING_PMCS(td->td_proc))
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
cpu_switch(td, newtd);
#ifdef HWPMC_HOOKS
if (PMC_PROC_IS_USING_PMCS(td->td_proc))
More information about the p4-projects
mailing list