Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: alan@nabeth.cxo.cpqcorp.net (Alan Rollow - Dr. File System's Home for Wayward Inodes.)
Subject: Re: info about cpu, memory and physical disk
Date: Tue, 30 Apr 2002 22:37:37 GMT	[thread overview]
Message-ID: <R0Fz8.35$bD1.729112@cacnews.cac.cpqcorp.net> (raw)
In-Reply-To: 820ca80a.0204301225.4f72b12d@posting.google.com

In article <820ca80a.0204301225.4f72b12d@posting.google.com>, carla_huang@yahoo.com (Carla) writes:

>According to some postings, I can get the following info from
>/dev/kmem. But I dont' see any postings about how to get it.

Actually, most of the information you want is available through
system calls, which is much more portable from version to version
than having go looking directly at kernel memory.

>
>each of the cpus -- such as -- idle tiem, user time, # of syscall,
>uptime.

See the manual page and include for the table(2) system call.  The
CPU information should be available using the TBL_SYSINFO code.
On recent Compaq and Digital implementations of OSF/1 (Digital
UNIX or Tru64 UNIX), you can the per-cpu information using the
TBL_MACHINE_SLOT code.

Uptime is a pretty easy; current-time - boot-time, displayed in
the format you see fit.  If the table(2) code TBL_SYSINFO is
available, it should have the boot time.  Otherwise you may
have to go to /dev/kmem.  Generally:

	Get the kernel name list using nlist(3).

	Open /dev/kmem

	Verify that the address of the boot time is valid and
	lseek(2) to it.

	Read as many bytes as the size of the boot time into
	program local space that is sufficiently large.

>
>memory -- such as -- # of page outs/in, # of pages pagged out/in, # of
>swap in/out, # of pages swapped in/out.

This is a bit more complicated.  In this case you're using the
typically undocumented Mach calls; vm_statistics().  My recollection
is that it goes something like:

	struct vm_statistics vmstat ;

	status = vm_statistics(current_task(), &vmstat) ;

A successful status is KERN_SUCCESS.  You should be able to find
the structure of the data in one of the include files.

>
>each of the physical disk -- such as -- disk name, # of read/write,
>active time.

Going back to the table(2) system call, use the TBL_DKINFO code.  The
include file will describe the structure of data you get back.

>
>Any idea?
>
--
Alan Rollow		alan@nabeth.cxo.cpqcorp.net (previously .dec.com)



      reply	other threads:[~2002-04-30 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-30 20:25 info about cpu, memory and physical disk Carla
2002-04-30 22:37 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. [this message]
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