Date: Tue, 13 Jun 2006 09:30:46 -0400 From: John Baldwin <jhb@freebsd.org> To: John Birrell <jb@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 99099 for review Message-ID: <200606130930.46610.jhb@freebsd.org> In-Reply-To: <200606130047.k5D0liTa052536@repoman.freebsd.org> References: <200606130047.k5D0liTa052536@repoman.freebsd.org>
index | next in thread | previous in thread | raw e-mail
On Monday 12 June 2006 20:47, John Birrell wrote: > 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. You should probably do this in mi_switch() in kern_synch.c rather than in this macro. > 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 > > -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.orghelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606130930.46610.jhb>
