From owner-freebsd-hackers Sun Nov 28 21: 5:15 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from c62443-a.frmt1.sfba.home.com (c62443-a.frmt1.sfba.home.com [24.0.69.165]) by hub.freebsd.org (Postfix) with ESMTP id 973601512B for ; Sun, 28 Nov 1999 21:05:14 -0800 (PST) (envelope-from adsharma@c62443-a.frmt1.sfba.home.com) Received: (from adsharma@localhost) by c62443-a.frmt1.sfba.home.com (8.9.3/8.9.3) id VAA01931; Sun, 28 Nov 1999 21:05:14 -0800 Date: Sun, 28 Nov 1999 21:05:14 -0800 From: Arun Sharma Message-Id: <199911290505.VAA01931@c62443-a.frmt1.sfba.home.com> To: freebsd-hackers@freebsd.org Subject: Fwd: Re: kstat - an API for gathering kernel stats Reply-To: adsharma@sharmas.dhs.org (Arun Sharma) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [ For some reason, this post through muc.lists.freebsd.hackers gateway didn't show up on the mailing list. Forwarding it to the mailing list.. ] On Thu, 04 Nov 1999 20:38:50 -0800, Mike Smith wrote: > > I don't see any examples in sys/modules. The SYSCTL_INT macros eventually > > expands to DATA_SET which puts certain data in a different ELF section. > > You don't do anything magic at all; it's handled invisibly by the > kernel linker. I was thinking about implementing SMP cpu stats using sysctl today and I have a question - can I create sysctl nodes dynamically ? i.e. for (cpu = 0; cpu < get_num_cpus(); cpu++) { /* create sysctl node here ? */ } Also, one simple solution to maintaining per cpu stats is to put the whole thing in struct globaldata. All existing code remains unchanged and automagically updates the per cpu stats. I may need to add some additional variables, which reflect system wide data. Now, if I put stuff in globaldata and try to export it using sysctl, things get a little more complex. One solution to the above problem is to use SMPpt relative addresses in the sysctl declarations. But given that the number of CPUs is known only at runtime, we come back to the first question in this mail. -Arun To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message