From owner-freebsd-arch@FreeBSD.ORG Sat May 24 17:48:57 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B97DF37B401; Sat, 24 May 2003 17:48:57 -0700 (PDT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id C265543F75; Sat, 24 May 2003 17:48:56 -0700 (PDT) (envelope-from hmp@nxad.com) Received: by perrin.int.nxad.com (Postfix, from userid 1072) id 9511320F01; Sat, 24 May 2003 17:48:55 -0700 (PDT) Date: Sat, 24 May 2003 17:48:55 -0700 From: Hiten Pandya To: arch@FreeBSD.ORG Message-ID: <20030525004855.GA67985@perrin.int.nxad.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline X-Operating-System: FreeBSD FreeBSD 4.7-STABLE User-Agent: Mutt/1.5.4i cc: des@FreeBSD.ORG Subject: scheduler determination X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 May 2003 00:48:58 -0000 --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 #include #include +#include #include #include -#include #include /* @@ -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 #include #include +#include #include #include #include -#include #include #include #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--