From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,8d8f2faf86e39c3f X-Google-Attributes: gid1164f8,public From: Joerg Czeranski Subject: Re: determining load average Date: 1999/07/16 Message-ID: <5wVQxinBA$5e4$1@joerch.org>#1/1 X-Deja-AN: 501550346 References: <378BE579.CB9E6404@swin.edu.au> <378E75EC.5493938@thynne.psych.nwux.edu> Organization: Joerch Software Newsgroups: comp.sys.dec Usman Muzaffar wrote in <378E75EC.5493938@thynne.psych.nwux.edu>: > Paul Bourke wrote: > > > > How does one getting the machine load? I'm about to do some parallel > > animations on a Dec farm (UNIX) and would like to check the load from > > my C source and not use that machine if the load is too high. Sure > > I can system("uptime") and parse the result....yuk. Surely there's > > a cleaner "standard" way? > > As I understand it, things about process information are more or > less guaranteed to be *different* between different operating systems, > which is why there is no POSIXish way to get at process information > at the lower level. I'm no fan of system() in C programs either, but > I'd guess in this case, uptime is the best way to go. > > But if anyone knows differently, please, let's hear it. > -usman If the solution is allowed to be Dec Unix specific, using table(TBL_LOADAVG, ...) is probably much more efficient than system("uptime") (or rather popen("uptime", "r")). I don't think there's a portable way without spawning uptime. Actually neither uptime nor w are Posix or XPG4, but I don't know a Unix that lacks them. joerch