Add the vtime (virtual time) hooks for DTrace.
This commit is contained in:
parent
ba3042115f
commit
6f5f25e521
@ -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__);
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user