diff options
author | Andrea Righi <righi.andrea@gmail.com> | 2008-07-27 11:29:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-27 12:58:20 -0400 |
commit | 5995477ab7f3522c497c9c4a1c55373e9d655574 (patch) | |
tree | a147fb61642a7ac5441855964eb97a2ff1e37202 /include/linux/task_io_accounting.h | |
parent | 605ccb73f6a1c891a16268b3a2923208fc637958 (diff) |
task IO accounting: improve code readability
Put all i/o statistics in struct proc_io_accounting and use inline functions to
initialize and increment statistics, removing a lot of single variable
assignments.
This also reduces the kernel size as following (with CONFIG_TASK_XACCT=y and
CONFIG_TASK_IO_ACCOUNTING=y).
text data bss dec hex filename
11651 0 0 11651 2d83 kernel/exit.o.before
11619 0 0 11619 2d63 kernel/exit.o.after
10886 132 136 11154 2b92 kernel/fork.o.before
10758 132 136 11026 2b12 kernel/fork.o.after
3082029 807968 4818600 8708597 84e1f5 vmlinux.o.before
3081869 807968 4818600 8708437 84e155 vmlinux.o.after
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Acked-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/task_io_accounting.h')
-rw-r--r-- | include/linux/task_io_accounting.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h index 44d00e9cceea..165390f8b936 100644 --- a/include/linux/task_io_accounting.h +++ b/include/linux/task_io_accounting.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * task_io_accounting: a structure which is used for recording a single task's | 2 | * proc_io_accounting: a structure which is used for recording a single task's |
3 | * IO statistics. | 3 | * IO statistics. |
4 | * | 4 | * |
5 | * Don't include this header file directly - it is designed to be dragged in via | 5 | * Don't include this header file directly - it is designed to be dragged in via |
@@ -8,6 +8,22 @@ | |||
8 | * Blame akpm@osdl.org for all this. | 8 | * Blame akpm@osdl.org for all this. |
9 | */ | 9 | */ |
10 | 10 | ||
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 | |||
11 | #ifdef CONFIG_TASK_IO_ACCOUNTING | 27 | #ifdef CONFIG_TASK_IO_ACCOUNTING |
12 | struct task_io_accounting { | 28 | struct task_io_accounting { |
13 | /* | 29 | /* |
@@ -31,7 +47,12 @@ struct task_io_accounting { | |||
31 | */ | 47 | */ |
32 | u64 cancelled_write_bytes; | 48 | u64 cancelled_write_bytes; |
33 | }; | 49 | }; |
34 | #else | 50 | #else /* CONFIG_TASK_IO_ACCOUNTING */ |
35 | struct task_io_accounting { | 51 | struct task_io_accounting { |
36 | }; | 52 | }; |
37 | #endif | 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 | }; | ||