*BSD News Article 78377


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!swidir.switch.ch!01-newsfeed.univie.ac.at!voskovec.radio.cz!www.nntp.primenet.com!nntp.primenet.com!swrinde.nde.swri.edu!news.uh.edu!lurch.sccsi.com!news.sccsi.com!nuchat!not-for-mail
From: gclarkii@main.gbdata.com (Gary Clark II)
Newsgroups: comp.unix.programmer,comp.os.linux.development.apps,comp.unix.bsd.freebsd.misc
Subject: Re: System call for querying system load?
Date: 15 Sep 1996 16:45:11 -0500
Organization: GB Data Systems (ISP, ICP and FreeBSD consulting)
Lines: 30
Message-ID: <51htd7$19t@main.gbdata.com>
References: <51cjj1$1k7@news.cyberenet.net> <DxrMGE.59t@pe1chl.ampr.org>
NNTP-Posting-Host: main.gbdata.com
Xref: euryale.cc.adfa.oz.au comp.unix.programmer:43257 comp.os.linux.development.apps:21854 comp.unix.bsd.freebsd.misc:27321

In article <DxrMGE.59t@pe1chl.ampr.org>, Rob Janssen <pe1chl@amsat.org> wrote:
>In <51cjj1$1k7@news.cyberenet.net> harry@cyberenet.net (Harry Hochheiser) writes:

>>I'm looking for a system call/subroutine that will let me query the system 
>>load.  This call would return information similar to that found in uptime(1), 
>>and should be roughly portable across BSD-like Unixes (i.e, Linux's sysinfo() 
>>won't work, even though that's my primary environment.

>There isn't any.  Retrieving the load average is a very non-portable
>operation, apparently nobody in the standards committees thought about
>a system call for this.


Hello,

I'm belive that for atleast the 4.4BSD derived systems you should be able
to look in libkvm for kvm_getloadavg.  Examples on how to use this can be
found in the 'w' program.  I know that FreeBSD uses this and I'm willing
to bet so do the other *BSDs.


Hope it helps,

Gary

-- 
Gary Clark II   (N5VMF) |    I speak only for myself and "maybe" my company 
gclarkii@GBData.COM     |          Member of the FreeBSD Doc Team 
  Providing Internet and ISP startups mail info@GBData.COM for information
   FreeBSD FAQ at ftp://ftp.FreeBSD.ORG/pub/FreeBSD/docs/freebsd-faq.ascii