From: Stephane Bortzmeyer <bortzmeyer () pasteur ! fr>
To: tru64-unix-managers
Subject: SUMMARY: Program for computing load average?
Date: Fri, 07 Feb 1997 15:35:24 +0000 [thread overview]
Message-ID: <96078608810161.tru64-unix-managers.marc@archive.invalid> (raw)
On Friday 7 February 97, at 15 h 10, the keyboard of Stephane Bortzmeyer
<bortzmeyer@pasteur.fr> wrote:
> Does anyone has the source code (I prefer in C) to compute the load
> average (as displayed by uptime or xload) on Digital Unix (3 and 4)? The
> code I had on Ultrix doesn't work anymore (the macro FIX_TO_DBL
> disappeared) and the thing is severely underdocumented...
The program is here. I forgot about table(2).
#include <stdio.h>
#include <sys/table.h>
main()
{
struct tbl_loadavg t;
table(TBL_LOADAVG, 0, &t, 1, sizeof(struct tbl_loadavg));
printf("%g %g %g\n", (double) t.tl_avenrun.l[0]/t.tl_lscale,
(double) t.tl_avenrun.l[1]/t.tl_lscale,
(double) t.tl_avenrun.l[2]/t.tl_lscale);
};
Many thanks to pas@hopper.unh.edu (Paul A Sand) who was really fast :-)
Christophe Wolfhugel told me about the sendmail sources: there is code
for every Unix to compute (in a different way) load average but sendmail
represents load as an integer, while I needed a floating-point (and I'm
not good enough for bit-level manipulations).
reply other threads:[~1997-02-07 15:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox