diff options
author | Andrew Morton <akpm@osdl.org> | 2006-12-10 05:19:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:55:41 -0500 |
commit | 4a7864ca638e0a38307962ee8ef122822a351b65 (patch) | |
tree | fb21754820a41365e524fafac11081cb52340a6f | |
parent | f2f1f8a3b86ccc5e998dc70a3ba35af199fdbc58 (diff) |
[PATCH] io-accounting: via taskstats
Deliver IO accounting via taskstats.
Cc: Jay Lan <jlan@sgi.com>
Cc: Shailabh Nagar <nagar@watson.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Chris Sturtivant <csturtiv@sgi.com>
Cc: Tony Ernst <tee@sgi.com>
Cc: Guillaume Thouvenin <guillaume.thouvenin@bull.net>
Cc: David Wright <daw@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/taskstats.h | 8 | ||||
-rw-r--r-- | kernel/tsacct.c | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h index 15c64037be1b..3fced4798255 100644 --- a/include/linux/taskstats.h +++ b/include/linux/taskstats.h | |||
@@ -31,7 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | 33 | ||
34 | #define TASKSTATS_VERSION 2 | 34 | #define TASKSTATS_VERSION 3 |
35 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN | 35 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN |
36 | * in linux/sched.h */ | 36 | * in linux/sched.h */ |
37 | 37 | ||
@@ -140,6 +140,12 @@ struct taskstats { | |||
140 | __u64 read_syscalls; /* read syscalls */ | 140 | __u64 read_syscalls; /* read syscalls */ |
141 | __u64 write_syscalls; /* write syscalls */ | 141 | __u64 write_syscalls; /* write syscalls */ |
142 | /* Extended accounting fields end */ | 142 | /* Extended accounting fields end */ |
143 | |||
144 | #define TASKSTATS_HAS_IO_ACCOUNTING | ||
145 | /* Per-task storage I/O accounting starts */ | ||
146 | __u64 read_bytes; /* bytes of read I/O */ | ||
147 | __u64 write_bytes; /* bytes of write I/O */ | ||
148 | __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */ | ||
143 | }; | 149 | }; |
144 | 150 | ||
145 | 151 | ||
diff --git a/kernel/tsacct.c b/kernel/tsacct.c index 96f77013d3f0..baacc3691415 100644 --- a/kernel/tsacct.c +++ b/kernel/tsacct.c | |||
@@ -96,6 +96,15 @@ void xacct_add_tsk(struct taskstats *stats, struct task_struct *p) | |||
96 | stats->write_char = p->wchar; | 96 | stats->write_char = p->wchar; |
97 | stats->read_syscalls = p->syscr; | 97 | stats->read_syscalls = p->syscr; |
98 | stats->write_syscalls = p->syscw; | 98 | stats->write_syscalls = p->syscw; |
99 | #ifdef CONFIG_TASK_IO_ACCOUNTING | ||
100 | stats->read_bytes = p->ioac.read_bytes; | ||
101 | stats->write_bytes = p->ioac.write_bytes; | ||
102 | stats->cancelled_write_bytes = p->ioac.cancelled_write_bytes; | ||
103 | #else | ||
104 | stats->read_bytes = 0; | ||
105 | stats->write_bytes = 0; | ||
106 | stats->cancelled_write_bytes = 0; | ||
107 | #endif | ||
99 | } | 108 | } |
100 | #undef KB | 109 | #undef KB |
101 | #undef MB | 110 | #undef MB |