From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,46bfbe51a6a5da16 X-Google-Attributes: gidfc89c,public X-Google-Thread: fee84,46bfbe51a6a5da16 X-Google-Attributes: gidfee84,public From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Subject: Re: CPU load and Disk I/O and load Date: 2000/04/17 Message-ID: <8dfggo$edu$1@mailint03.im.hou.compaq.com>#1/1 X-Deja-AN: 612305056 Distribution: world References: <38FA916C.11B07EC0@ot.com.au> X-Complaints-To: usenet@mailint03.im.hou.compaq.com X-Trace: mailint03.im.hou.compaq.com 955991384 14782 16.82.16.67 (17 Apr 2000 17:09:44 GMT) Organization: Digital Equipment Corporation Reply-To: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) NNTP-Posting-Date: 17 Apr 2000 17:09:44 GMT Newsgroups: comp.unix.osf.osf1,comp.unix.programmer In article <38FA916C.11B07EC0@ot.com.au>, Raj Calisa writes: >I work on Digital Unix V4.0D. I need to write a program that >determines the load on the CPU and also gather disk I/O >statistics. From these two things, I need to determine if >the system is loaded or not based some some user defined >threshold(s). As someone else suggested, you might want to look at existing utilities to see if they meet your needs. If the problem is one of formatting the data differently, then look at the programs which collect this data and which also have sources available. You might also want to look at collect and Monitor which should be on the Freeware CDROM. A newer version of Monitor is available on gatekeeper.dec.com:/pub/DEC/monitor.alpha.tar.Z. >I figured that I need to use the table(2) system call. Does the >load average that is returned by table() reflect (at least to >some extent) the load on the CPU? If not what else determines >it? What do you consider CPU load? The stats available from table(2) using the code TBL_SYSINFO record time spent in the different CPU modes; user, nice, kernel, wait and idle. Older versions of the operating system only had one of these structures available for multi-CPU systems. I've read that V5 presents this data on a per-CPU basis, but I don't know what V4 does. The load average is described in the uptime manual page. It is a pretty good measure of overall system load, but systems are complex and one measurement rarely describes everything that contributes to load. >For disk statistics, I am not sure how to interpret >tbl_dkinfo struct. Any help in this is appreciated. Up to the number of disks that the interface supports, each disk on the system is allocated one of these data structures. The first entry of the table, records the number of entries in the table (which may be a fixed value and thus, next to useless). The unit and name fields correspond to the disk for which statistics are being collected. Through V4, I don't believe this unit information reflects SCSI targets that support multiple logical units making it appears that there are multiple entries per disk. You have to go deeper into the kernel to see which logical unit corresponds to which table entry. You can look at the Monitor sources to see how it does this. I believe di_busy is simply a flag to indicate that the entry represents an active disk. The di_xfer and di_wds field represent number of transfers completed and number of "words" transferred by the disk. I think the "word" size of this data structure is 64 bytes. It is easy enough to verify with a simple controlled I/O test. I suspect the di_seek field only gets counted for disks that require an explicit seek operation to access a given logical block. Most modern storage protocols hide the seek insides an I/O request for the block. Generally you'll see this field as zero. I don't recall what the di_time field counts. Some modern versions do fill in the later stats, which are as described in the include file. > >thanks. > >raj... > -- Alan Rollow alan@nabeth.cxo.dec.com