From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 10 07:59:16 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 350FE16A422 for ; Tue, 10 Jan 2006 07:59:16 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: from web30006.mail.mud.yahoo.com (web30006.mail.mud.yahoo.com [68.142.200.69]) by mx1.FreeBSD.org (Postfix) with SMTP id 9DE1443D49 for ; Tue, 10 Jan 2006 07:59:11 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: (qmail 72060 invoked by uid 60001); 10 Jan 2006 07:59:10 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ePm2mVdf0j28Fo450SykoJ6r6awwWwcRvOAs/GgLk1QqeI4fvxs3D5W391Af3qIc2r2MXjbEls3nig0p0q26F2aCSu4giwE1+QMgi9rB3XiQnZ8DGRwvya1RwDZ2eibLucBVr821b4IoCdL8M5cZIetnUDHZXGyWNb6Io+wY4JY= ; Message-ID: <20060110075910.72058.qmail@web30006.mail.mud.yahoo.com> Received: from [202.161.131.69] by web30006.mail.mud.yahoo.com via HTTP; Mon, 09 Jan 2006 23:59:10 PST Date: Mon, 9 Jan 2006 23:59:10 -0800 (PST) From: kamal kc To: freebsd In-Reply-To: <20060110054656.GE89638@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: using get_system_info() - obtaining system load averages X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2006 07:59:16 -0000 --- Dan Nelson wrote: > In the last episode (Jan 09), kamal kc said: > > dear everybody, > > > > i want to use the routine get_system_info() to get > the load averages > > of the cpu. i found it that top uses it. > > get_system_info is just a function /in/ top itself > that gets the CPU > usage. It uses the vm.loadavg sysctl to get the > load average. A > simpler way is to just call the getloadavg() > function; see its manpage > for more info. thanks i tried getloadavg() it worked. but when i tried to put it in the kernel the kernel failed to link. i also looked at sysctl(3) and i guess it is also for user based programs. so i looked at the sys/sysctl.h and found that there was sysctl_find_oid() that was defined for kernel. but i don't know how to use it. i could not get any info on the web. the function declaration was :: int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int *nindx, struct sysctl_req *req); isn't it the function i should be using to retrieve the sysctl value ??? how should i use it ?? any demo on using it would be immensely helpful for me. thanks, kamal __________________________________________ Yahoo! DSL – Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com