diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2005-04-19 04:01:25 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2005-04-19 04:01:25 +0000 |
commit | dc3444cd91762fa913e417f7f7a7a0484872f54e (patch) | |
tree | 3175e06cfbec643ca7426d756f2362160f9309d4 /sys/kern/sched_4bsd.c | |
parent | 8c509864f2dd0cdcc6116de38bf9137583c4ab2f (diff) | |
download | FreeBSD-src-dc3444cd91762fa913e417f7f7a7a0484872f54e.zip FreeBSD-src-dc3444cd91762fa913e417f7f7a7a0484872f54e.tar.gz |
Bring a working snapshot of hwpmc(4), its associated libraries, userland utilities
and documentation into -CURRENT.
Bump FreeBSD_version.
Reviewed by: alc, jhb (kernel changes)
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 552ab56..e56d156 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); |