From owner-freebsd-hackers Sat Feb 26 11:17:32 2000 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 CC62937B524 for ; Sat, 26 Feb 2000 11:17:24 -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 LAA16205; Sat, 26 Feb 2000 11:17:24 -0800 Date: Sat, 26 Feb 2000 11:17:24 -0800 From: Arun Sharma Message-Id: <200002261917.LAA16205@c62443-a.frmt1.sfba.home.com> To: freebsd-hackers@freebsd.org Subject: Re: Finding percent idle Reply-To: adsharma@sharmas.dhs.org (Arun Sharma) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 25 Feb 2000 14:25:46 -0500, James Housley wrote: > I am trying to find out the current % idle of the machine from within a > program. I have looked at the valuse provided by sysctl and found > loadavg but not system idle. I have also looked through the source for > top and haven't been able to figure that out. All pointers would be > appreciated. As another poster pointed out, all of the FreeBSD programs (top, vmstat, xosview, ktop) get this stuff from kvm - which is a non portable (across different versions of FreeBSD) interface. FreeBSD also doesn't keep these numbers on a per CPU basis on a SMP box. I wrote a patch for fixing the SMP case and a KLD to get them via sysctl. With slight modifications to the KLD, you can get those values exported via sysctl. The KLD is available at: http://sharmas.dhs.org/~adsharma/projects/freebsd/sysctl.tar.gz -Arun To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message