diff options
author | Andrew Morton <akpm@osdl.org> | 2006-12-10 05:19:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:55:42 -0500 |
commit | cf709844d8a8fa21c59772d1a069ae0efa15e981 (patch) | |
tree | 0570acf49b9b732c7da3bc49a9714274a535fe84 /Documentation | |
parent | d2f7bf13461e8ead863126ee1e8ba92105959ecc (diff) |
[PATCH] io-accounting: add to getdelays
Wire up the IO accounting into getdelays.c.
Usage:
To display I/O stats for each exitting task:
vmm:/home/akpm> ./getdelays -m0,1,2,3 -i -l
cpumask 0 maskset 1
printing IO accounting
listen forever
rm: read=8192, write=0, cancelled_write=0
cvs: read=733184, write=4255744, cancelled_write=4096
make: read=217088, write=0, cancelled_write=0
cc1: read=4263936, write=12288, cancelled_write=0
as: read=811008, write=8192, cancelled_write=0
gcc: read=323584, write=0, cancelled_write=12288
cc1: read=0, write=8192, cancelled_write=0
as: read=4096, write=4096, cancelled_write=0
gcc: read=16384, write=0, cancelled_write=4096
as: read=4096, write=4096, cancelled_write=0
gcc: read=16384, write=0, cancelled_write=8192
ld: read=1011712, write=16384, cancelled_write=0
collect2: read=626688, write=0, cancelled_write=0
gcc: read=204800, write=0, cancelled_write=0
cc1: read=0, write=8192, cancelled_write=0
as: read=4096, write=4096, cancelled_write=0
gcc: read=16384, write=0, cancelled_write=8192
ld: read=8192, write=16384, cancelled_write=0
collect2: read=49152, write=0, cancelled_write=0
gcc: read=0, write=0, cancelled_write=0
cc1: read=0, write=4096, cancelled_write=0
ld: read=4096, write=12288, cancelled_write=0
collect2: read=49152, write=0, cancelled_write=0
gcc: read=0, write=0, cancelled_write=0
To display I/O stats for a particular presently-running task:
vmm:/home/akpm> ./getdelays -i -p $(pidof crond)
printing IO accounting
crond: read=61440, write=0, cancelled_write=0
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>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/accounting/getdelays.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index 93dd04f86a27..e9126e794ed7 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -48,6 +48,7 @@ int rcvbufsz; | |||
48 | char name[100]; | 48 | char name[100]; |
49 | int dbg; | 49 | int dbg; |
50 | int print_delays; | 50 | int print_delays; |
51 | int print_io_accounting; | ||
51 | __u64 stime, utime; | 52 | __u64 stime, utime; |
52 | 53 | ||
53 | #define PRINTF(fmt, arg...) { \ | 54 | #define PRINTF(fmt, arg...) { \ |
@@ -195,6 +196,15 @@ void print_delayacct(struct taskstats *t) | |||
195 | "count", "delay total", t->swapin_count, t->swapin_delay_total); | 196 | "count", "delay total", t->swapin_count, t->swapin_delay_total); |
196 | } | 197 | } |
197 | 198 | ||
199 | void print_ioacct(struct taskstats *t) | ||
200 | { | ||
201 | printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", | ||
202 | t->ac_comm, | ||
203 | (unsigned long long)t->read_bytes, | ||
204 | (unsigned long long)t->write_bytes, | ||
205 | (unsigned long long)t->cancelled_write_bytes); | ||
206 | } | ||
207 | |||
198 | int main(int argc, char *argv[]) | 208 | int main(int argc, char *argv[]) |
199 | { | 209 | { |
200 | int c, rc, rep_len, aggr_len, len2, cmd_type; | 210 | int c, rc, rep_len, aggr_len, len2, cmd_type; |
@@ -217,7 +227,7 @@ int main(int argc, char *argv[]) | |||
217 | struct msgtemplate msg; | 227 | struct msgtemplate msg; |
218 | 228 | ||
219 | while (1) { | 229 | while (1) { |
220 | c = getopt(argc, argv, "dw:r:m:t:p:v:l"); | 230 | c = getopt(argc, argv, "diw:r:m:t:p:v:l"); |
221 | if (c < 0) | 231 | if (c < 0) |
222 | break; | 232 | break; |
223 | 233 | ||
@@ -226,6 +236,10 @@ int main(int argc, char *argv[]) | |||
226 | printf("print delayacct stats ON\n"); | 236 | printf("print delayacct stats ON\n"); |
227 | print_delays = 1; | 237 | print_delays = 1; |
228 | break; | 238 | break; |
239 | case 'i': | ||
240 | printf("printing IO accounting\n"); | ||
241 | print_io_accounting = 1; | ||
242 | break; | ||
229 | case 'w': | 243 | case 'w': |
230 | strncpy(logfile, optarg, MAX_FILENAME); | 244 | strncpy(logfile, optarg, MAX_FILENAME); |
231 | printf("write to file %s\n", logfile); | 245 | printf("write to file %s\n", logfile); |
@@ -247,14 +261,12 @@ int main(int argc, char *argv[]) | |||
247 | if (!tid) | 261 | if (!tid) |
248 | err(1, "Invalid tgid\n"); | 262 | err(1, "Invalid tgid\n"); |
249 | cmd_type = TASKSTATS_CMD_ATTR_TGID; | 263 | cmd_type = TASKSTATS_CMD_ATTR_TGID; |
250 | print_delays = 1; | ||
251 | break; | 264 | break; |
252 | case 'p': | 265 | case 'p': |
253 | tid = atoi(optarg); | 266 | tid = atoi(optarg); |
254 | if (!tid) | 267 | if (!tid) |
255 | err(1, "Invalid pid\n"); | 268 | err(1, "Invalid pid\n"); |
256 | cmd_type = TASKSTATS_CMD_ATTR_PID; | 269 | cmd_type = TASKSTATS_CMD_ATTR_PID; |
257 | print_delays = 1; | ||
258 | break; | 270 | break; |
259 | case 'v': | 271 | case 'v': |
260 | printf("debug on\n"); | 272 | printf("debug on\n"); |
@@ -367,6 +379,8 @@ int main(int argc, char *argv[]) | |||
367 | count++; | 379 | count++; |
368 | if (print_delays) | 380 | if (print_delays) |
369 | print_delayacct((struct taskstats *) NLA_DATA(na)); | 381 | print_delayacct((struct taskstats *) NLA_DATA(na)); |
382 | if (print_io_accounting) | ||
383 | print_ioacct((struct taskstats *) NLA_DATA(na)); | ||
370 | if (fd) { | 384 | if (fd) { |
371 | if (write(fd, NLA_DATA(na), na->nla_len) < 0) { | 385 | if (write(fd, NLA_DATA(na), na->nla_len) < 0) { |
372 | err(1,"write error\n"); | 386 | err(1,"write error\n"); |