From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,2cf3eaa5727719af X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 2002-04-30 15:34:43 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!news.compaq.com!cacnews.cac.cpqcorp.net!53ab2750!not-for-mail Newsgroups: comp.unix.osf.osf1 From: alan@nabeth.cxo.cpqcorp.net (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Distribution: world References: <820ca80a.0204301225.4f72b12d@posting.google.com> Reply-To: alan@nabeth.cxo.cpqcorp.net (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Subject: Re: info about cpu, memory and physical disk Message-ID: Date: Tue, 30 Apr 2002 22:37:37 GMT NNTP-Posting-Host: 16.112.5.128 X-Complaints-To: abuse@Compaq.com X-Trace: cacnews.cac.cpqcorp.net 1020206257 16.112.5.128 (Tue, 30 Apr 2002 15:37:37 PDT) NNTP-Posting-Date: Tue, 30 Apr 2002 15:37:37 PDT Organization: Compaq Computer Corporation Xref: archiver1.google.com comp.unix.osf.osf1:106 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)