From owner-freebsd-hackers Thu Nov 4 14: 7:18 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rdc1.sfba.home.com (ha1.rdc1.sfba.home.com [24.0.0.66]) by hub.freebsd.org (Postfix) with ESMTP id E6CA915136 for ; Thu, 4 Nov 1999 14:07:13 -0800 (PST) (envelope-from adsharma@c62443-a.frmt1.sfba.home.com) Received: from c62443-a.frmt1.sfba.home.com ([24.0.69.165]) by mail.rdc1.sfba.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <19991104220551.BVFX11261.mail.rdc1.sfba.home.com@c62443-a.frmt1.sfba.home.com>; Thu, 4 Nov 1999 14:05:51 -0800 Received: (from adsharma@localhost) by c62443-a.frmt1.sfba.home.com (8.9.3/8.9.3) id OAA01360; Thu, 4 Nov 1999 14:05:51 -0800 Date: Thu, 4 Nov 1999 14:05:51 -0800 From: Arun Sharma To: "Matthew N. Dodd" Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: kstat - an API for gathering kernel stats Message-ID: <19991104140551.A1331@home.com> References: <19991104092304.A708@home.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=vtzGhvizbBRQ85DL X-Mailer: Mutt 0.95.6i In-Reply-To: ; from Matthew N. Dodd on Thu, Nov 04, 1999 at 12:52:50PM -0500 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii On Thu, Nov 04, 1999 at 12:52:50PM -0500, Matthew N. Dodd wrote: > On Thu, 4 Nov 1999, Arun Sharma wrote: > > I just looked at the sysctl implementation and there are some differences. > > Moreover, since it was not being used in tools like vmstat and xosview, > > I thought there must be a reason. > > > > sysctl also seems to assume that it doesn't get called frequently. So > > mapping the name to the sysctl data is a slightly more heavy duty > > operation than a hash table lookup. > > Wouldn't hashing the sysctl OIDs be the way to go then? > > Why invent another namespace? > Please see the attached mail. Yes - I didn't look closely at sysctl, before I started working on kstat. My argument is that we need different interfaces for kernel tuning (which is what sysctl seems to be good at) and kernel performance statistics collection. The former activity is more heavy weight than the latter. -Arun --vtzGhvizbBRQ85DL Content-Type: message/rfc822 Date: Thu, 4 Nov 1999 09:58:41 -0800 From: Arun Sharma To: "Ronald G. Minnich" Subject: Re: kstat - an API for gathering kernel stats Message-ID: <19991104095841.B708@home.com> References: <19991103215642.A31757@home.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i In-Reply-To: ; from Ronald G. Minnich on Thu, Nov 04, 1999 at 08:26:14AM -0700 On Thu, Nov 04, 1999 at 08:26:14AM -0700, Ronald G. Minnich wrote: > quick question: is this better than sysctl, and if so why? I worry about > adding new system calls. To be honest, I didn't look closely at sysctl before I started writing kstat, which was primarily meant to be an exercise in learning BSD. A few differences: (a) sysctl seems to be more appropriate for kernel tuning than performance monitoring. Even if it can do performance monitoring as efficiently as kstat, I think it makes sense to keep the kernel tuning and performance monitoring interfaces separate. (b) kstat uses a hash table lookup to map the counter name to the counter value. Which should make it a little bit faster. (c) kstat allows multiple instances of the same counter (cpu.nice for CPU1 and CPU2 for eg). -Arun --vtzGhvizbBRQ85DL-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message