Date: Sat, 24 May 2003 17:48:55 -0700 From: Hiten Pandya <hmp@FreeBSD.ORG> To: arch@FreeBSD.ORG Cc: des@FreeBSD.ORG Subject: scheduler determination Message-ID: <20030525004855.GA67985@perrin.int.nxad.com>
next in thread | raw e-mail | index | archive | help
--RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Gang. It would be really nice if there was a way to find out the name of the current scheduler in the system. I have attached a patch which adds a sysctl called kern.sched.name, which does just that. Comments and suggestions welcome. Cheers. -- Hiten (hmp@FreeBSD.ORG) --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="scheduler-name.patch" Index: kern/kern_mib.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_mib.c,v retrieving revision 1.65 diff -u -r1.65 kern_mib.c --- kern/kern_mib.c 30 Apr 2003 12:57:39 -0000 1.65 +++ kern/kern_mib.c 25 May 2003 00:04:44 -0000 @@ -85,6 +85,8 @@ "Regression test MIB"); #endif +SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, "SCHED"); + SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD, osrelease, 0, "Operating system release"); Index: kern/sched_4bsd.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sched_4bsd.c,v retrieving revision 1.18 diff -u -r1.18 sched_4bsd.c --- kern/sched_4bsd.c 30 Apr 2003 12:57:39 -0000 1.18 +++ kern/sched_4bsd.c 25 May 2003 00:44:07 -0000 @@ -46,9 +46,9 @@ #include <sys/mutex.h> #include <sys/proc.h> #include <sys/resourcevar.h> +#include <sys/sysctl.h> #include <sys/sched.h> #include <sys/smp.h> -#include <sys/sysctl.h> #include <sys/sx.h> /* @@ -87,6 +87,10 @@ SYSINIT(sched_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, sched_setup, NULL) +static char sched_name[] = "4bsd"; +SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, sched_name, 0, + "Current scheduler"); + /* * Global run queue. */ @@ -109,7 +113,7 @@ return (0); } -SYSCTL_PROC(_kern, OID_AUTO, quantum, CTLTYPE_INT|CTLFLAG_RW, +SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof sched_quantum, sysctl_kern_quantum, "I", "Roundrobin scheduling quantum in microseconds"); Index: kern/sched_ule.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sched_ule.c,v retrieving revision 1.34 diff -u -r1.34 sched_ule.c --- kern/sched_ule.c 2 May 2003 06:18:55 -0000 1.34 +++ kern/sched_ule.c 25 May 2003 00:43:08 -0000 @@ -34,10 +34,10 @@ #include <sys/mutex.h> #include <sys/proc.h> #include <sys/resource.h> +#include <sys/sysctl.h> #include <sys/sched.h> #include <sys/smp.h> #include <sys/sx.h> -#include <sys/sysctl.h> #include <sys/sysproto.h> #include <sys/vmmeter.h> #ifdef DDB @@ -60,7 +60,9 @@ static void sched_setup(void *dummy); SYSINIT(sched_setup, SI_SUB_RUN_QUEUE, SI_ORDER_FIRST, sched_setup, NULL) -static SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, "SCHED"); +static char sched_name[] = "ule"; +SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, sched_name, 0, + "Current scheduler"); static int sched_strict; SYSCTL_INT(_kern_sched, OID_AUTO, strict, CTLFLAG_RD, &sched_strict, 0, ""); Index: sys/sched.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sched.h,v retrieving revision 1.4 diff -u -r1.4 sched.h --- sys/sched.h 11 Apr 2003 03:39:06 -0000 1.4 +++ sys/sched.h 25 May 2003 00:17:35 -0000 @@ -92,4 +92,8 @@ extern struct p_sched *proc0_sched; extern struct td_sched *thread0_sched; +#ifdef SYSCTL_DECL +SYSCTL_DECL(_kern_sched); +#endif + #endif /* !_SYS_SCHED_H_ */ --RnlQjJ0d97Da+TV1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030525004855.GA67985>