From 8dd9d4012aca49d211a0d43c6069beab71ed5a1c Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 31 Jul 2003 01:36:24 +0000 Subject: When ktracing context switches, make sure we record involuntary switches. Otherwise, when we get a evicted from the cpu, there is no record of it. This is not a default ktrace flag. --- sys/kern/subr_trap.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sys/kern/subr_trap.c') diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 3c0a760..05d250d 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -40,6 +40,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ktrace.h" #include "opt_mac.h" #ifdef __i386__ #include "opt_npx.h" @@ -59,6 +60,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#include +#endif + #include #include @@ -236,11 +242,19 @@ ast(struct trapframe *framep) mac_thread_userret(td); #endif if (flags & TDF_NEEDRESCHED) { +#ifdef KTRACE + if (KTRPOINT(td, KTR_CSW)) + ktrcsw(1, 0); +#endif mtx_lock_spin(&sched_lock); sched_prio(td, kg->kg_user_pri); p->p_stats->p_ru.ru_nivcsw++; mi_switch(); mtx_unlock_spin(&sched_lock); +#ifdef KTRACE + if (KTRPOINT(td, KTR_CSW)) + ktrcsw(0, 0); +#endif } if (flags & TDF_NEEDSIGCHK) { PROC_LOCK(p); -- cgit v1.1