From owner-freebsd-hackers Fri Sep 19 16:15:19 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id QAA17079 for hackers-outgoing; Fri, 19 Sep 1997 16:15:19 -0700 (PDT) Received: from mexico.brainstorm.eu.org (root@mexico.brainstorm.fr [193.56.58.253]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id QAA17053 for ; Fri, 19 Sep 1997 16:14:51 -0700 (PDT) Received: from brasil.brainstorm.eu.org (brasil.brainstorm.fr [193.56.58.33]) by mexico.brainstorm.eu.org (8.8.4/8.8.4) with ESMTP id BAA13687 for ; Sat, 20 Sep 1997 01:14:39 +0200 Received: (from uucp@localhost) by brasil.brainstorm.eu.org (8.8.6/brasil-1.2) with UUCP id BAA22677 for hackers@FreeBSD.ORG; Sat, 20 Sep 1997 01:14:12 +0200 Received: (from roberto@localhost) by keltia.freenix.fr (8.8.7/keltia-2.10/nospam) id BAA15949; Sat, 20 Sep 1997 01:02:54 +0200 (CEST) Message-ID: <19970920010254.04892@keltia.freenix.fr> Date: Sat, 20 Sep 1997 01:02:54 +0200 From: Ollivier Robert To: hackers@FreeBSD.ORG Subject: Re: cpu load References: <199709172011.NAA13541@usr02.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.76 In-Reply-To: <199709172011.NAA13541@usr02.primenet.com>; from Terry Lambert on Wed, Sep 17, 1997 at 08:11:30PM +0000 X-Operating-System: FreeBSD 3.0-CURRENT ctm#3649 AMD-K6 MMX @ 208 MHz Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk According to Terry Lambert: > If it is not a wrapper function for a sysctl(0 call, it should be. UTSL :-) int getloadavg(loadavg, nelem) double loadavg[]; int nelem; { struct loadavg loadinfo; int i, mib[2]; size_t size; mib[0] = CTL_VM; mib[1] = VM_LOADAVG; size = sizeof(loadinfo); if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) < 0) return (-1); nelem = MIN(nelem, sizeof(loadinfo.ldavg) / sizeof(fixpt_t)); for (i = 0; i < nelem; i++) loadavg[i] = (double) loadinfo.ldavg[i] / loadinfo.fscale; return (nelem); } -- Ollivier ROBERT -=- FreeBSD: There are no limits -=- roberto@keltia.freenix.fr FreeBSD keltia.freenix.fr 3.0-CURRENT #34: Sun Sep 14 16:30:44 CEST 1997