Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* info about cpu, memory and physical disk
@ 2002-04-30 20:25 Carla
  2002-04-30 22:37 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  0 siblings, 1 reply; 2+ messages in thread
From: Carla @ 2002-04-30 20:25 UTC (permalink / raw)


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

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

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

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

Any idea?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: info about cpu, memory and physical disk
  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.
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 2002-04-30 22:37 UTC (permalink / raw)


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)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-30 22:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox