Date: Tue, 13 Jun 2006 00:47:44 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99099 for review Message-ID: <200606130047.k5D0liTa052536@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99099 Change 99099 by jb@jb_freebsd2 on 2006/06/13 00:47:28 Add hooks for DTrace to register a function to be called when the scheduler chooses a new thread to run. This is required for DTrace vtime. Affected files ... .. //depot/projects/dtrace/src/sys/kern/kern_switch.c#3 edit .. //depot/projects/dtrace/src/sys/sys/proc.h#6 edit Differences ... ==== //depot/projects/dtrace/src/sys/kern/kern_switch.c#3 (text+ko) ==== @@ -88,6 +88,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.121 2006/06/01 22:45:56 cognet Exp $"); +#include "opt_kdtrace.h" #include "opt_sched.h" #ifndef KERN_SWITCH_INCLUDE @@ -126,6 +127,11 @@ #define td_kse td_sched +#ifdef KDTRACE +int dtrace_vtime_active; +dtrace_vtime_switch_func_t dtrace_vtime_switch_func; +#endif + /* * kern.sched.preemption allows user space to determine if preemption support * is compiled in or not. It is not currently a boot or runtime flag that ==== //depot/projects/dtrace/src/sys/sys/proc.h#6 (text+ko) ==== @@ -484,7 +484,17 @@ #define TD_CLR_SUSPENDED(td) TD_CLR_INHIB((td), TDI_SUSPENDED) #define TD_CLR_IWAIT(td) TD_CLR_INHIB((td), TDI_IWAIT) +#ifdef KDTRACE +typedef void (*dtrace_vtime_switch_func_t)(struct thread *); + +extern int dtrace_vtime_active; +extern dtrace_vtime_switch_func_t dtrace_vtime_switch_func; +#define TD_SET_RUNNING(td) if (dtrace_vtime_active) \ + (*dtrace_vtime_switch_func)(td); \ + (td)->td_state = TDS_RUNNING +#else #define TD_SET_RUNNING(td) (td)->td_state = TDS_RUNNING +#endif #define TD_SET_RUNQ(td) (td)->td_state = TDS_RUNQ #define TD_SET_CAN_RUN(td) (td)->td_state = TDS_CAN_RUN
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606130047.k5D0liTa052536>