diff options
| author | Joseph Koshy <jkoshy@FreeBSD.org> | 2005-04-19 04:01:25 +0000 |
|---|---|---|
| committer | Joseph Koshy <jkoshy@FreeBSD.org> | 2005-04-19 04:01:25 +0000 |
| commit | ebccf1e3a6b11b97cbf5f813dd76636e892a9035 (patch) | |
| tree | 3175e06cfbec643ca7426d756f2362160f9309d4 /sys/kern/sched_4bsd.c | |
| parent | 5b930f51c99986e0488914780510637221c46d76 (diff) | |
Notes
Diffstat (limited to 'sys/kern/sched_4bsd.c')
| -rw-r--r-- | sys/kern/sched_4bsd.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 552ab56d8dd3..e56d156d57f3 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -53,6 +53,10 @@ __FBSDID("$FreeBSD$"); #include <sys/turnstile.h> #include <machine/smp.h> +#ifdef HWPMC_HOOKS +#include <sys/pmckern.h> +#endif + /* * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in * the range 100-256 Hz (approximately). @@ -959,8 +963,18 @@ sched_switch(struct thread *td, struct thread *newtd, int flags) newtd = choosethread(); } - if (td != newtd) + if (td != newtd) { +#ifdef HWPMC_HOOKS + if (PMC_PROC_IS_USING_PMCS(td->td_proc)) + PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); +#endif cpu_switch(td, newtd); +#ifdef HWPMC_HOOKS + if (PMC_PROC_IS_USING_PMCS(td->td_proc)) + PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_IN); +#endif + } + sched_lock.mtx_lock = (uintptr_t)td; td->td_oncpu = PCPU_GET(cpuid); } @@ -1284,6 +1298,13 @@ sched_unbind(struct thread* td) } int +sched_is_bound(struct thread *td) +{ + mtx_assert(&sched_lock, MA_OWNED); + return (td->td_kse->ke_flags & KEF_BOUND); +} + +int sched_load(void) { return (sched_tdcnt); |
