diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2009-01-17 07:17:57 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2009-01-17 07:17:57 +0000 |
commit | 8f51ad55e728371ce9a00ef8fb9fcc89b9b3a7e6 (patch) | |
tree | de5dcf2f543f8bc9f57e15ad2509863476bbe371 /sys/kern/kern_synch.c | |
parent | 6ec351236802ad416d6f03498db9df75b09dacec (diff) | |
download | src-8f51ad55e728371ce9a00ef8fb9fcc89b9b3a7e6.tar.gz src-8f51ad55e728371ce9a00ef8fb9fcc89b9b3a7e6.zip |
- Implement generic macros for producing KTR records that are compatible
with src/tools/sched/schedgraph.py. This allows developers to quickly
create a graphical view of ktr data for any resource in the system.
- Add sched_tdname() and the pcpu field 'name' for quickly and uniformly
identifying records associated with a thread or cpu.
- Reimplement the KTR_SCHED traces using the new generic facility.
Obtained from: attilio
Discussed with: jhb
Sponsored by: Nokia
Notes
Notes:
svn path=/head/; revision=187357
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 53e3ced77721..bc539afe1cc5 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -71,6 +71,13 @@ __FBSDID("$FreeBSD$"); #include <vm/pmap.h> #endif +#define KTDSTATE(td) \ + (((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" : \ + ((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" : \ + ((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" : \ + ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \ + ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding") + static void synch_setup(void *dummy); SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup, NULL); @@ -425,25 +432,19 @@ mi_switch(int flags, struct thread *newtd) td->td_tid, td->td_sched, p->p_pid, td->td_name); #if (KTR_COMPILE & KTR_SCHED) != 0 if (TD_IS_IDLETHREAD(td)) - CTR3(KTR_SCHED, "mi_switch: %p(%s) prio %d idle", - td, td->td_name, td->td_priority); - else if (newtd != NULL) - CTR5(KTR_SCHED, - "mi_switch: %p(%s) prio %d preempted by %p(%s)", - td, td->td_name, td->td_priority, newtd, - newtd->td_name); + KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "idle", + "prio:%d", td->td_priority); else - CTR6(KTR_SCHED, - "mi_switch: %p(%s) prio %d inhibit %d wmesg %s lock %s", - td, td->td_name, td->td_priority, - td->td_inhibitors, td->td_wmesg, td->td_lockname); + KTR_STATE3(KTR_SCHED, "thread", sched_tdname(td), KTDSTATE(td), + "prio:%d", td->td_priority, "wmesg:\"%s\"", td->td_wmesg, + "lockname:\"%s\"", td->td_lockname); #endif #ifdef XEN PT_UPDATES_FLUSH(); #endif sched_switch(td, newtd, flags); - CTR3(KTR_SCHED, "mi_switch: running %p(%s) prio %d", - td, td->td_name, td->td_priority); + KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "running", + "prio:%d", td->td_priority); CTR4(KTR_PROC, "mi_switch: new thread %ld (td_sched %p, pid %ld, %s)", td->td_tid, td->td_sched, p->p_pid, td->td_name); |