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>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 12 June 2006 20:47, John Birrell wrote: > http://perforce.freebsd.org/chv.cgi?CH=3D99099 >=20 > Change 99099 by jb@jb_freebsd2 on 2006/06/13 00:47:28 >=20 > 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 ... >=20 > .. //depot/projects/dtrace/src/sys/kern/kern_switch.c#3 edit > .. //depot/projects/dtrace/src/sys/sys/proc.h#6 edit >=20 > Differences ... >=20 > =3D=3D=3D=3D //depot/projects/dtrace/src/sys/kern/kern_switch.c#3 (text+k= o) =3D=3D=3D=3D >=20 > @@ -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 $"); > =20 > +#include "opt_kdtrace.h" > #include "opt_sched.h" > =20 > #ifndef KERN_SWITCH_INCLUDE > @@ -126,6 +127,11 @@ > =20 > #define td_kse td_sched > =20 > +#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 su= pport > * is compiled in or not. It is not currently a boot or runtime flag th= at >=20 > =3D=3D=3D=3D //depot/projects/dtrace/src/sys/sys/proc.h#6 (text+ko) =3D= =3D=3D=3D >=20 > @@ -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) > =20 > +#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 =3D TDS_RUNNING > +#else > #define TD_SET_RUNNING(td) (td)->td_state =3D TDS_RUNNING > +#endif > #define TD_SET_RUNQ(td) (td)->td_state =3D TDS_RUNQ > #define TD_SET_CAN_RUN(td) (td)->td_state =3D TDS_CAN_RUN > =20 >=20 =2D-=20 John Baldwin <jhb@FreeBSD.org> =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606130930.46610.jhb>