Thank you for your reply. But when I tried to use iostat command, the system said " iostat:command not found". The vmstat command works well. I don't know why. Thanks. Raymond
From: Randall R Schulz <rschulz@sonic.net> To: suse-linux-e@suse.com Subject: Re: [SLE] How to get disk IO information? Date: Sat, 3 Sep 2005 18:26:13 -0700
Raymond,
On Saturday 03 September 2005 16:47, raymond raymond wrote:
Hi, thanks for your reply. Actually, I want to get the disk IO information in a program and use it. So, I need to know where can I get it. Using a command to get it is not what I want. I found a file namd vmstat. It contains the page in and page out information, but no disk IO information. Could someone tell me how to get it?
First of all, you should not so quickly write off using a program to produce the information you require. Typically, the implementation of programs such as iostat and vmstat will track any change in the manner in which the underlying data is accessed and formatted. If you go straight to those files in /proc or /sys, your program becomes vulnerable to changes in their content. Between the popen(3) and scanf(3) library routines, you should be able to get the information you need from iostat.
In any event, here's something to add to your bag of tricks:
# What executable files hold iostat and vmstat? % type -p iostat vmstat /usr/bin/iostat /usr/bin/vmstat
# What use of absolute file system names are made by iostat and vmstat? % strings /usr/bin/iostat |egrep ^/ /lib/ld-linux.so.2 /proc/stat /proc/partitions /proc/diskstats /sys/block /dev/ /usr/share/locale
% strings /usr/bin/vmstat |egrep ^/ /lib/ld-linux.so.2 /proc/diskstats /proc/slabinfo /proc/sys/kernel/pid_max /proc/vmstat /proc/meminfo /proc/stat /proc /proc/%s/stat /proc/loadavg /proc/uptime
This tells you which system status files these two programs use to produce their listings.
It looks like /proc/diskstats holds a nice summary. Search the Web for information on the format of the information therein. Be sure to note how it has changed since its inception in the 2.5 kernel.
Thanks.
Raymond
Randall Schulz
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
_________________________________________________________________ Take advantage of powerful junk e-mail filters built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.