Andrew Morton | 7c3ab738 | 2006-12-10 02:19:19 -0800 | [diff] [blame] | 1 | /* |
Andrea Righi | 5995477 | 2008-07-27 17:29:15 +0200 | [diff] [blame^] | 2 | * proc_io_accounting: a structure which is used for recording a single task's |
Andrew Morton | 7c3ab738 | 2006-12-10 02:19:19 -0800 | [diff] [blame] | 3 | * IO statistics. |
| 4 | * |
| 5 | * Don't include this header file directly - it is designed to be dragged in via |
| 6 | * sched.h. |
| 7 | * |
| 8 | * Blame akpm@osdl.org for all this. |
| 9 | */ |
| 10 | |
Andrea Righi | 5995477 | 2008-07-27 17:29:15 +0200 | [diff] [blame^] | 11 | #ifdef CONFIG_TASK_XACCT |
| 12 | struct task_chr_io_accounting { |
| 13 | /* bytes read */ |
| 14 | u64 rchar; |
| 15 | /* bytes written */ |
| 16 | u64 wchar; |
| 17 | /* # of read syscalls */ |
| 18 | u64 syscr; |
| 19 | /* # of write syscalls */ |
| 20 | u64 syscw; |
| 21 | }; |
| 22 | #else /* CONFIG_TASK_XACCT */ |
| 23 | struct task_chr_io_accounting { |
| 24 | }; |
| 25 | #endif /* CONFIG_TASK_XACCT */ |
| 26 | |
Andrew Morton | 7c3ab738 | 2006-12-10 02:19:19 -0800 | [diff] [blame] | 27 | #ifdef CONFIG_TASK_IO_ACCOUNTING |
| 28 | struct task_io_accounting { |
| 29 | /* |
| 30 | * The number of bytes which this task has caused to be read from |
| 31 | * storage. |
| 32 | */ |
| 33 | u64 read_bytes; |
| 34 | |
| 35 | /* |
| 36 | * The number of bytes which this task has caused, or shall cause to be |
| 37 | * written to disk. |
| 38 | */ |
| 39 | u64 write_bytes; |
| 40 | |
| 41 | /* |
| 42 | * A task can cause "negative" IO too. If this task truncates some |
| 43 | * dirty pagecache, some IO which another task has been accounted for |
| 44 | * (in its write_bytes) will not be happening. We _could_ just |
| 45 | * subtract that from the truncating task's write_bytes, but there is |
| 46 | * information loss in doing that. |
| 47 | */ |
| 48 | u64 cancelled_write_bytes; |
| 49 | }; |
Andrea Righi | 5995477 | 2008-07-27 17:29:15 +0200 | [diff] [blame^] | 50 | #else /* CONFIG_TASK_IO_ACCOUNTING */ |
Andrew Morton | 7c3ab738 | 2006-12-10 02:19:19 -0800 | [diff] [blame] | 51 | struct task_io_accounting { |
| 52 | }; |
Andrea Righi | 5995477 | 2008-07-27 17:29:15 +0200 | [diff] [blame^] | 53 | #endif /* CONFIG_TASK_IO_ACCOUNTING */ |
| 54 | |
| 55 | struct proc_io_accounting { |
| 56 | struct task_chr_io_accounting chr; |
| 57 | struct task_io_accounting blk; |
| 58 | }; |