Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 2002 11:22:21 -0700
From:      "Christopher J. Umina" <FJU@Fritzilldo.com>
To:        "Giorgos Keramidas" <keramida@ceid.upatras.gr>
Cc:        "FreeBSD Questions" <questions@FreeBSD.ORG>
Subject:   Re: Load Averages with C
Message-ID:  <001901c20fe2$9988cc60$0301a8c0@uminafamily.com>
References:  <001201c20f54$46ba9e20$0301a8c0@uminafamily.com> <20020608222753.GA38586@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
Why when I use getloadavg(3) do I come out with wierd numbers?

This is my code.

#include <stdio.h>
#include <stdlib.h>

int main(void) {
        int i;
        double loadavg[3];
        int getloadavg(double loadavg[], int nelem);

        for (i = 0; i < 3; ++i) {
                printf ("%d\n", loadavg[i]);
        }
}

and my output is always different, but it's:

%./loadavg
1
4
663

This time.  What can I do to make these numbers correct?

What am I doing wrong?

Thanks.
----- Original Message -----
From: "Giorgos Keramidas" <keramida@ceid.upatras.gr>
To: "Christopher J. Umina" <FJU@Fritzilldo.com>
Cc: "FreeBSD Questions" <questions@FreeBSD.ORG>
Sent: Saturday, June 08, 2002 3:27 PM
Subject: Re: Load Averages with C


> On 2002-06-08 18:23 -0700, Christopher J. Umina wrote:
> > Hello,
> >     Does anybody know how to make a C or C++ program that returns load
> > averages on the server?  I've been searching all over and I can't find
it.
>
> 01:27 [charon@hades /home/charon]$ man -k load | grep average
> getloadavg(3)            - get system load averages
> kvm_getloadavg(3)        - get load average of the system
>
> - Giorgos
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001901c20fe2$9988cc60$0301a8c0>