aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Kletzing <devzero@web.de>2007-03-05 03:30:54 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-05 10:57:54 -0500
commitf9c99463b0cd05603d125c915e2886d55a686b82 (patch)
tree1ad8dbe05e053bf47fed277ea269993e4c8cec40
parent721c04c65f5905ef64732394f6ae147be0aebf69 (diff)
[PATCH] Documentation for io-accounting / reporting via procfs
Add some documentation for the new and very useful io-accounting feature. It's being added to Documentation/filesystems/proc.txt Signed-off-by: Roland Kletzing <devzero@web.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/filesystems/proc.txt105
1 files changed, 105 insertions, 0 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 72af5de1effb..5484ab5efd4f 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -41,6 +41,7 @@ Table of Contents
41 2.11 /proc/sys/fs/mqueue - POSIX message queues filesystem 41 2.11 /proc/sys/fs/mqueue - POSIX message queues filesystem
42 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score 42 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score
43 2.13 /proc/<pid>/oom_score - Display current oom-killer score 43 2.13 /proc/<pid>/oom_score - Display current oom-killer score
44 2.14 /proc/<pid>/io - Display the IO accounting fields
44 45
45------------------------------------------------------------------------------ 46------------------------------------------------------------------------------
46Preface 47Preface
@@ -1990,3 +1991,107 @@ need to recompile the kernel, or even to reboot the system. The files in the
1990command to write value into these files, thereby changing the default settings 1991command to write value into these files, thereby changing the default settings
1991of the kernel. 1992of the kernel.
1992------------------------------------------------------------------------------ 1993------------------------------------------------------------------------------
1994
19952.14 /proc/<pid>/io - Display the IO accounting fields
1996-------------------------------------------------------
1997
1998This file contains IO statistics for each running process
1999
2000Example
2001-------
2002
2003test:/tmp # dd if=/dev/zero of=/tmp/test.dat &
2004[1] 3828
2005
2006test:/tmp # cat /proc/3828/io
2007rchar: 323934931
2008wchar: 323929600
2009syscr: 632687
2010syscw: 632675
2011read_bytes: 0
2012write_bytes: 323932160
2013cancelled_write_bytes: 0
2014
2015
2016Description
2017-----------
2018
2019rchar
2020-----
2021
2022I/O counter: chars read
2023The number of bytes which this task has caused to be read from storage. This
2024is simply the sum of bytes which this process passed to read() and pread().
2025It includes things like tty IO and it is unaffected by whether or not actual
2026physical disk IO was required (the read might have been satisfied from
2027pagecache)
2028
2029
2030wchar
2031-----
2032
2033I/O counter: chars written
2034The number of bytes which this task has caused, or shall cause to be written
2035to disk. Similar caveats apply here as with rchar.
2036
2037
2038syscr
2039-----
2040
2041I/O counter: read syscalls
2042Attempt to count the number of read I/O operations, i.e. syscalls like read()
2043and pread().
2044
2045
2046syscw
2047-----
2048
2049I/O counter: write syscalls
2050Attempt to count the number of write I/O operations, i.e. syscalls like
2051write() and pwrite().
2052
2053
2054read_bytes
2055----------
2056
2057I/O counter: bytes read
2058Attempt to count the number of bytes which this process really did cause to
2059be fetched from the storage layer. Done at the submit_bio() level, so it is
2060accurate for block-backed filesystems. <please add status regarding NFS and
2061CIFS at a later time>
2062
2063
2064write_bytes
2065-----------
2066
2067I/O counter: bytes written
2068Attempt to count the number of bytes which this process caused to be sent to
2069the storage layer. This is done at page-dirtying time.
2070
2071
2072cancelled_write_bytes
2073---------------------
2074
2075The big inaccuracy here is truncate. If a process writes 1MB to a file and
2076then deletes the file, it will in fact perform no writeout. But it will have
2077been accounted as having caused 1MB of write.
2078In other words: The number of bytes which this process caused to not happen,
2079by truncating pagecache. A task can cause "negative" IO too. If this task
2080truncates some dirty pagecache, some IO which another task has been accounted
2081for (in it's write_bytes) will not be happening. We _could_ just subtract that
2082from the truncating task's write_bytes, but there is information loss in doing
2083that.
2084
2085
2086Note
2087----
2088
2089At its current implementation state, this is a bit racy on 32-bit machines: if
2090process A reads process B's /proc/pid/io while process B is updating one of
2091those 64-bit counters, process A could see an intermediate result.
2092
2093
2094More information about this can be found within the taskstats documentation in
2095Documentation/accounting.
2096
2097------------------------------------------------------------------------------