From owner-freebsd-hackers Wed Apr 19 8:13:39 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id EC7CF37BCB2 for ; Wed, 19 Apr 2000 08:13:34 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (sol.cs.binghamton.edu [128.226.123.100]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with ESMTP id LAA13289; Wed, 19 Apr 2000 11:13:27 -0400 (EDT) Date: Wed, 19 Apr 2000 11:13:25 -0400 (EDT) From: Zhihui Zhang To: Andrzej Bialecki Cc: freebsd-hackers@freebsd.org Subject: Re: NFS attribute cache & profiling sysctl variables In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 16 Apr 2000, Andrzej Bialecki wrote: > On Sat, 15 Apr 2000, Zhihui Zhang wrote: > > > > > I have two unrelated questions I can not figure out myself: > > > (2) I am trying to display kernel profiling sysctl variables with sysctl > > -a or sysctl -A without success. They are defined in subr_prof.c. Why > > sysctl command can not display them? I can use kgmon. > I spend some time on this. It turns out that you can not do a sysctl() on a node without a handler. For the case of kern.prof, there is a handler, but that handler - sysctl_kern_prof() - only allows you to access lower level variables. When you do sysctl -a or sysctl -A, you use the special {0,2, ..} names to get the next oids in the MIB tree. In the routine sysctl_sysctl_next_ls(), you can see that a node with a handler is skipped by the following statements: if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) continue; if (oidp->oid_handler) continue; That is why you can not show kern.prof stuff with command sysctl -a or sysctl -A. You have to use the way shown in usr.sbin/kgmon/kgmon.c. -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message