Date: Sat, 20 Sep 1997 01:02:54 +0200 From: Ollivier Robert <roberto@keltia.freenix.fr> To: hackers@FreeBSD.ORG Subject: Re: cpu load Message-ID: <19970920010254.04892@keltia.freenix.fr> In-Reply-To: <199709172011.NAA13541@usr02.primenet.com>; from Terry Lambert on Wed, Sep 17, 1997 at 08:11:30PM %2B0000 References: <Pine.BSF.3.95q.970917100550.20301E-100000@misery.sdf.com> <199709172011.NAA13541@usr02.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970920010254.04892>