From owner-freebsd-questions Sun Jun 9 8:21: 6 2002 Delivered-To: freebsd-questions@freebsd.org Received: from smtp.mailix.net (smtp.mailix.net [216.148.213.132]) by hub.freebsd.org (Postfix) with ESMTP id 7861237B405 for ; Sun, 9 Jun 2002 08:21:01 -0700 (PDT) Received: from [216.164.225.145] (helo=fritz) by smtp.mailix.net with asmtp (Exim 4.01) id 17H4V2-0000Ll-00; Sun, 09 Jun 2002 08:21:00 -0700 Message-ID: <001901c20fe2$9988cc60$0301a8c0@uminafamily.com> From: "Christopher J. Umina" To: "Giorgos Keramidas" Cc: "FreeBSD Questions" References: <001201c20f54$46ba9e20$0301a8c0@uminafamily.com> <20020608222753.GA38586@hades.hell.gr> Subject: Re: Load Averages with C Date: Sun, 9 Jun 2002 11:22:21 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Why when I use getloadavg(3) do I come out with wierd numbers? This is my code. #include #include 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" To: "Christopher J. Umina" Cc: "FreeBSD Questions" 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