System call for querying system load?

System call for querying system load?

Post by Harry Hochheis » Sat, 14 Sep 1996 04:00:00



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.

While I'm at it, can anyone clue me in to a source describing proper
interpretation of the load averages returned by uptime?

Sorry if these are FAQ's.  Please reply via email, and I'll summarize if
necessary.

Thanks,

Harry Hochheiser

---------------


08 3A B5 F6 47 7F C7 C4 28 B4 8D D2 2E DF F6 1E

 
 
 

System call for querying system load?

Post by Matthew Dill » Mon, 16 Sep 1996 04:00:00




:>
:>
:>>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
:...

    Actually, there is a call now:  getloadavg(double loadavg[], int nelem),
    but who knows whether it is compatible with anyone else's.

                                        -Matt

--
    Matthew Dillon   Engineering, BEST Internet Communications, Inc.

    [always include a portion of the original email in any response!]

 
 
 

System call for querying system load?

Post by Gary Clark » Mon, 16 Sep 1996 04:00:00




>>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


   FreeBSD FAQ at ftp://ftp.FreeBSD.ORG/pub/FreeBSD/docs/freebsd-faq.ascii

 
 
 

System call for querying system load?

Post by Julian Elische » Thu, 19 Sep 1996 04:00:00




>     Actually, there is a call now:  getloadavg(double loadavg[], int nelem),
>     but who knows whether it is compatible with anyone else's.

Under FreeBSD it;s a sysctl cariable that can be retrieved
from teh system using the sysctl facility...
vm.loadavg

e.g. sysctl vm.loadavg

julian

 
 
 

System call for querying system load?

Post by Steve Weiga » Thu, 19 Sep 1996 04:00:00






>>>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.

If you have rpc up and running and can do an "rup" on the machine,
that may be the easiest way.

C yas,
  - Steve Weigand

 
 
 

System call for querying system load?

Post by Paul Woute » Sat, 21 Sep 1996 04:00:00


Just open the file /proc/loadavg and read and parse the data.

Paul
--
Due to my recent postings in various Usenet newsgroups, I have been flooded
with unwanted, unsolicited, commercial email. I have taken steps to automate
my, not so polite, retaliation. I am sorry I am forced to do this, but I
am receiving several junk emails a day now.  You have been warned.

 
 
 

System call for querying system load?

Post by Jordan K. Hubbar » Sun, 22 Sep 1996 04:00:00



> Just open the file /proc/loadavg and read and parse the data.

Or, even easier, call getloadavg(3).
--
- Jordan Hubbard
  President, FreeBSD Project
 
 
 

System call for querying system load?

Post by Jordan K. Hubbar » Sun, 22 Sep 1996 04:00:00


Reposting article removed by rogue canceller.


> Just open the file /proc/loadavg and read and parse the data.

Or, even easier, call getloadavg(3).
--
- Jordan Hubbard
  President, FreeBSD Project
 
 
 

1. Kernel Extension(system call) loaded but could not call it !!!!

Hi ,
can anybody tell me why I am unable to call my own system call.

/* This is the kernel extension I wrote */

testcall_entry(int cmd, struct uio *uio)
{

   if (cmd == CFG_INIT) {
      if (pincode(testcall_entry) != 0) { /* pin the kernel ext into
memory */
         return(ENOMEM);                  /* report error  */
         }
      }
   else {
      unpincode(testcall_entry);
   }
   return(0);

/* These are the steps I followed to compile the extension */
cc -c -O -qlist -qsource testcall.c
ld -e testcall_entry -T512 -H512 -bI:./testcall.exp -bI:./kernex.exp
testcall.o -o testcall

/* this is a test system call */
int testcall()
{
        return 10;

Yes I did load the kernel extension and it was loaded successfully and
gave me kmid also.

/* This is a sample file to test system call */
main ()

{
        int val = 0;

        printf ("value before testcall %d\n",val);
        val = testcall ();
        printf ("value after testcall %d\n",val);

/* This is what I use to compile this program */
cc -bI:./kernex.exp -bI:./testcall.exp sample.c

/* This is the error it gives  when I run the a.out file */
exec(): 0509-036 Cannot load program a.out because of the following
errors:
        0509-023 Symbol testcall in a.out is not defined.
        0509-026 System error: Cannot run a file that does not have a
valid format.

Nilesh

2. Problem with POST on Apache

3. How I could add a new system call to linux or modify a system calls

4. ssh/X11 forwarding/rlogin question (X11 authentication loading mostly)

5. How to use open system call in a new system call

6. WD90C33, problem with probe

7. "Interrupted system call" at "low level" - system calls

8. Just get... Kill this thread. You'll be glad. (You don't have a choice)

9. Historical query: Library functions upgraded to system calls?

10. How to query system load

11. DAT query, inter-system and same system weirdness

12. C-function for system load call in Solaris 2.5.X and 2.6

13. System calls to evaluate "load" ?