diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-05-11 01:22:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 11:29:34 -0400 |
commit | 6eaeeaba39e5fa3d52a0bb8de15e995516ae251a (patch) | |
tree | 5b4052fabfe107ad5332cb758ad8d86ea5a87848 /include/linux/sched.h | |
parent | 02239c29967418284c05d58971894d658575e78c (diff) |
getrusage(): fill ru_inblock and ru_oublock fields if possible
If CONFIG_TASK_IO_ACCOUNTING is defined, we update io accounting counters for
each task.
This patch permits reporting of values using the well known getrusage()
syscall, filling ru_inblock and ru_oublock instead of null values.
As TASK_IO_ACCOUNTING currently counts bytes counts, we approximate blocks
count doing : nr_blocks = nr_bytes / 512
Example of use :
----------------------
After patch is applied, /usr/bin/time command can now give a good
approximation of IO that the process had to do.
$ /usr/bin/time grep tototo /usr/include/*
Command exited with non-zero status 1
0.00user 0.02system 0:02.11elapsed 1%CPU (0avgtext+0avgdata 0maxresident)k
24288inputs+0outputs (0major+259minor)pagefaults 0swaps
$ /usr/bin/time dd if=/dev/zero of=/tmp/testfile count=1000
1000+0 enregistrements lus
1000+0 enregistrements écrits
512000 octets (512 kB) copiés, 0,00326601 seconde, 157 MB/s
0.00user 0.00system 0:00.00elapsed 80%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+3000outputs (0major+299minor)pagefaults 0swaps
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 17b72d88c4cb..75f44379b7e9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -469,6 +469,7 @@ struct signal_struct { | |||
469 | cputime_t utime, stime, cutime, cstime; | 469 | cputime_t utime, stime, cutime, cstime; |
470 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 470 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
471 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; | 471 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; |
472 | unsigned long inblock, oublock, cinblock, coublock; | ||
472 | 473 | ||
473 | /* | 474 | /* |
474 | * Cumulative ns of scheduled CPU time for dead threads in the | 475 | * Cumulative ns of scheduled CPU time for dead threads in the |