diff options
author | Shailabh Nagar <nagar@watson.ibm.com> | 2006-07-14 03:24:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-15 00:53:57 -0400 |
commit | a3baf649ca9ca0a96fba538f03b0f17c043b755c (patch) | |
tree | 6022cb01cd494f59dd474030f2d9980413000036 /Documentation/accounting/delay-accounting.txt | |
parent | 6f44993fe1d7b2b097f6ac60cd5835c6f5ca0874 (diff) |
[PATCH] per-task-delay-accounting: documentation
Some documentation for delay accounting.
Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com>
Signed-off-by: Balbir Singh <balbir@in.ibm.com>
Cc: Jes Sorensen <jes@sgi.com>
Cc: Peter Chubb <peterc@gelato.unsw.edu.au>
Cc: Erich Focht <efocht@ess.nec.de>
Cc: Levent Serinol <lserinol@gmail.com>
Cc: Jay Lan <jlan@engr.sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'Documentation/accounting/delay-accounting.txt')
-rw-r--r-- | Documentation/accounting/delay-accounting.txt | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/Documentation/accounting/delay-accounting.txt b/Documentation/accounting/delay-accounting.txt new file mode 100644 index 000000000000..f3dc0ca04fa4 --- /dev/null +++ b/Documentation/accounting/delay-accounting.txt | |||
@@ -0,0 +1,115 @@ | |||
1 | Delay accounting | ||
2 | ---------------- | ||
3 | |||
4 | Tasks encounter delays in execution when they wait | ||
5 | for some kernel resource to become available e.g. a | ||
6 | runnable task may wait for a free CPU to run on. | ||
7 | |||
8 | The per-task delay accounting functionality measures | ||
9 | the delays experienced by a task while | ||
10 | |||
11 | a) waiting for a CPU (while being runnable) | ||
12 | b) completion of synchronous block I/O initiated by the task | ||
13 | c) swapping in pages | ||
14 | |||
15 | and makes these statistics available to userspace through | ||
16 | the taskstats interface. | ||
17 | |||
18 | Such delays provide feedback for setting a task's cpu priority, | ||
19 | io priority and rss limit values appropriately. Long delays for | ||
20 | important tasks could be a trigger for raising its corresponding priority. | ||
21 | |||
22 | The functionality, through its use of the taskstats interface, also provides | ||
23 | delay statistics aggregated for all tasks (or threads) belonging to a | ||
24 | thread group (corresponding to a traditional Unix process). This is a commonly | ||
25 | needed aggregation that is more efficiently done by the kernel. | ||
26 | |||
27 | Userspace utilities, particularly resource management applications, can also | ||
28 | aggregate delay statistics into arbitrary groups. To enable this, delay | ||
29 | statistics of a task are available both during its lifetime as well as on its | ||
30 | exit, ensuring continuous and complete monitoring can be done. | ||
31 | |||
32 | |||
33 | Interface | ||
34 | --------- | ||
35 | |||
36 | Delay accounting uses the taskstats interface which is described | ||
37 | in detail in a separate document in this directory. Taskstats returns a | ||
38 | generic data structure to userspace corresponding to per-pid and per-tgid | ||
39 | statistics. The delay accounting functionality populates specific fields of | ||
40 | this structure. See | ||
41 | include/linux/taskstats.h | ||
42 | for a description of the fields pertaining to delay accounting. | ||
43 | It will generally be in the form of counters returning the cumulative | ||
44 | delay seen for cpu, sync block I/O, swapin etc. | ||
45 | |||
46 | Taking the difference of two successive readings of a given | ||
47 | counter (say cpu_delay_total) for a task will give the delay | ||
48 | experienced by the task waiting for the corresponding resource | ||
49 | in that interval. | ||
50 | |||
51 | When a task exits, records containing the per-task and per-process statistics | ||
52 | are sent to userspace without requiring a command. More details are given in | ||
53 | the taskstats interface description. | ||
54 | |||
55 | The getdelays.c userspace utility in this directory allows simple commands to | ||
56 | be run and the corresponding delay statistics to be displayed. It also serves | ||
57 | as an example of using the taskstats interface. | ||
58 | |||
59 | Usage | ||
60 | ----- | ||
61 | |||
62 | Compile the kernel with | ||
63 | CONFIG_TASK_DELAY_ACCT=y | ||
64 | CONFIG_TASKSTATS=y | ||
65 | |||
66 | Enable the accounting at boot time by adding | ||
67 | the following to the kernel boot options | ||
68 | delayacct | ||
69 | |||
70 | and after the system has booted up, use a utility | ||
71 | similar to getdelays.c to access the delays | ||
72 | seen by a given task or a task group (tgid). | ||
73 | The utility also allows a given command to be | ||
74 | executed and the corresponding delays to be | ||
75 | seen. | ||
76 | |||
77 | General format of the getdelays command | ||
78 | |||
79 | getdelays [-t tgid] [-p pid] [-c cmd...] | ||
80 | |||
81 | |||
82 | Get delays, since system boot, for pid 10 | ||
83 | # ./getdelays -p 10 | ||
84 | (output similar to next case) | ||
85 | |||
86 | Get sum of delays, since system boot, for all pids with tgid 5 | ||
87 | # ./getdelays -t 5 | ||
88 | |||
89 | |||
90 | CPU count real total virtual total delay total | ||
91 | 7876 92005750 100000000 24001500 | ||
92 | IO count delay total | ||
93 | 0 0 | ||
94 | MEM count delay total | ||
95 | 0 0 | ||
96 | |||
97 | Get delays seen in executing a given simple command | ||
98 | # ./getdelays -c ls / | ||
99 | |||
100 | bin data1 data3 data5 dev home media opt root srv sys usr | ||
101 | boot data2 data4 data6 etc lib mnt proc sbin subdomain tmp var | ||
102 | |||
103 | |||
104 | CPU count real total virtual total delay total | ||
105 | 6 4000250 4000000 0 | ||
106 | IO count delay total | ||
107 | 0 0 | ||
108 | MEM count delay total | ||
109 | 0 0 | ||
110 | |||
111 | |||
112 | |||
113 | |||
114 | |||
115 | |||