diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-11-07 23:11:32 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-11-07 23:11:32 +0000 |
commit | ab85f615594d29298c8047225622a1e35dabe4fa (patch) | |
tree | cff98fa09441a16f9e67be698d090db0b2da1636 /sys/kern/kern_switch.c | |
parent | e9b8703c85231f8a66ce85044ca4a9bd918d43fd (diff) | |
download | FreeBSD-src-ab85f615594d29298c8047225622a1e35dabe4fa.zip FreeBSD-src-ab85f615594d29298c8047225622a1e35dabe4fa.tar.gz |
Add basic critical section tracing to KTR using event type KTR_CRITICAL.
This generates a KTR event for each critical section entered and exited.
It would be desirable to also log the filename and line number of the
source entering or exiting the critical section, but this requires
hacking up the critical section API, so I've not done that yet.
Diffstat (limited to 'sys/kern/kern_switch.c')
-rw-r--r-- | sys/kern/kern_switch.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index b337e9da..06a34d7 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -573,6 +573,8 @@ critical_enter(void) if (td->td_critnest == 0) cpu_critical_enter(td); td->td_critnest++; + CTR4(KTR_CRITICAL, "critical_enter by thread %p (%ld, %s) to %d", td, + (long)td->td_proc->p_pid, td->td_proc->p_comm, td->td_critnest); } void @@ -601,6 +603,8 @@ critical_exit(void) } else { td->td_critnest--; } + CTR4(KTR_CRITICAL, "critical_exit by thread %p (%ld, %s) to %d", td, + (long)td->td_proc->p_pid, td->td_proc->p_comm, td->td_critnest); } /* |