diff options
Diffstat (limited to 'Documentation/accounting/taskstats-struct.txt')
-rw-r--r-- | Documentation/accounting/taskstats-struct.txt | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/Documentation/accounting/taskstats-struct.txt b/Documentation/accounting/taskstats-struct.txt new file mode 100644 index 000000000000..661c797eaf79 --- /dev/null +++ b/Documentation/accounting/taskstats-struct.txt | |||
@@ -0,0 +1,161 @@ | |||
1 | The struct taskstats | ||
2 | -------------------- | ||
3 | |||
4 | This document contains an explanation of the struct taskstats fields. | ||
5 | |||
6 | There are three different groups of fields in the struct taskstats: | ||
7 | |||
8 | 1) Common and basic accounting fields | ||
9 | If CONFIG_TASKSTATS is set, the taskstats inteface is enabled and | ||
10 | the common fields and basic accounting fields are collected for | ||
11 | delivery at do_exit() of a task. | ||
12 | 2) Delay accounting fields | ||
13 | These fields are placed between | ||
14 | /* Delay accounting fields start */ | ||
15 | and | ||
16 | /* Delay accounting fields end */ | ||
17 | Their values are collected if CONFIG_TASK_DELAY_ACCT is set. | ||
18 | 3) Extended accounting fields | ||
19 | These fields are placed between | ||
20 | /* Extended accounting fields start */ | ||
21 | and | ||
22 | /* Extended accounting fields end */ | ||
23 | Their values are collected if CONFIG_TASK_XACCT is set. | ||
24 | |||
25 | Future extension should add fields to the end of the taskstats struct, and | ||
26 | should not change the relative position of each field within the struct. | ||
27 | |||
28 | |||
29 | struct taskstats { | ||
30 | |||
31 | 1) Common and basic accounting fields: | ||
32 | /* The version number of this struct. This field is always set to | ||
33 | * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>. | ||
34 | * Each time the struct is changed, the value should be incremented. | ||
35 | */ | ||
36 | __u16 version; | ||
37 | |||
38 | /* The exit code of a task. */ | ||
39 | __u32 ac_exitcode; /* Exit status */ | ||
40 | |||
41 | /* The accounting flags of a task as defined in <linux/acct.h> | ||
42 | * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG. | ||
43 | */ | ||
44 | __u8 ac_flag; /* Record flags */ | ||
45 | |||
46 | /* The value of task_nice() of a task. */ | ||
47 | __u8 ac_nice; /* task_nice */ | ||
48 | |||
49 | /* The name of the command that started this task. */ | ||
50 | char ac_comm[TS_COMM_LEN]; /* Command name */ | ||
51 | |||
52 | /* The scheduling discipline as set in task->policy field. */ | ||
53 | __u8 ac_sched; /* Scheduling discipline */ | ||
54 | |||
55 | __u8 ac_pad[3]; | ||
56 | __u32 ac_uid; /* User ID */ | ||
57 | __u32 ac_gid; /* Group ID */ | ||
58 | __u32 ac_pid; /* Process ID */ | ||
59 | __u32 ac_ppid; /* Parent process ID */ | ||
60 | |||
61 | /* The time when a task begins, in [secs] since 1970. */ | ||
62 | __u32 ac_btime; /* Begin time [sec since 1970] */ | ||
63 | |||
64 | /* The elapsed time of a task, in [usec]. */ | ||
65 | __u64 ac_etime; /* Elapsed time [usec] */ | ||
66 | |||
67 | /* The user CPU time of a task, in [usec]. */ | ||
68 | __u64 ac_utime; /* User CPU time [usec] */ | ||
69 | |||
70 | /* The system CPU time of a task, in [usec]. */ | ||
71 | __u64 ac_stime; /* System CPU time [usec] */ | ||
72 | |||
73 | /* The minor page fault count of a task, as set in task->min_flt. */ | ||
74 | __u64 ac_minflt; /* Minor Page Fault Count */ | ||
75 | |||
76 | /* The major page fault count of a task, as set in task->maj_flt. */ | ||
77 | __u64 ac_majflt; /* Major Page Fault Count */ | ||
78 | |||
79 | |||
80 | 2) Delay accounting fields: | ||
81 | /* Delay accounting fields start | ||
82 | * | ||
83 | * All values, until the comment "Delay accounting fields end" are | ||
84 | * available only if delay accounting is enabled, even though the last | ||
85 | * few fields are not delays | ||
86 | * | ||
87 | * xxx_count is the number of delay values recorded | ||
88 | * xxx_delay_total is the corresponding cumulative delay in nanoseconds | ||
89 | * | ||
90 | * xxx_delay_total wraps around to zero on overflow | ||
91 | * xxx_count incremented regardless of overflow | ||
92 | */ | ||
93 | |||
94 | /* Delay waiting for cpu, while runnable | ||
95 | * count, delay_total NOT updated atomically | ||
96 | */ | ||
97 | __u64 cpu_count; | ||
98 | __u64 cpu_delay_total; | ||
99 | |||
100 | /* Following four fields atomically updated using task->delays->lock */ | ||
101 | |||
102 | /* Delay waiting for synchronous block I/O to complete | ||
103 | * does not account for delays in I/O submission | ||
104 | */ | ||
105 | __u64 blkio_count; | ||
106 | __u64 blkio_delay_total; | ||
107 | |||
108 | /* Delay waiting for page fault I/O (swap in only) */ | ||
109 | __u64 swapin_count; | ||
110 | __u64 swapin_delay_total; | ||
111 | |||
112 | /* cpu "wall-clock" running time | ||
113 | * On some architectures, value will adjust for cpu time stolen | ||
114 | * from the kernel in involuntary waits due to virtualization. | ||
115 | * Value is cumulative, in nanoseconds, without a corresponding count | ||
116 | * and wraps around to zero silently on overflow | ||
117 | */ | ||
118 | __u64 cpu_run_real_total; | ||
119 | |||
120 | /* cpu "virtual" running time | ||
121 | * Uses time intervals seen by the kernel i.e. no adjustment | ||
122 | * for kernel's involuntary waits due to virtualization. | ||
123 | * Value is cumulative, in nanoseconds, without a corresponding count | ||
124 | * and wraps around to zero silently on overflow | ||
125 | */ | ||
126 | __u64 cpu_run_virtual_total; | ||
127 | /* Delay accounting fields end */ | ||
128 | /* version 1 ends here */ | ||
129 | |||
130 | |||
131 | 3) Extended accounting fields | ||
132 | /* Extended accounting fields start */ | ||
133 | |||
134 | /* Accumulated RSS usage in duration of a task, in MBytes-usecs. | ||
135 | * The current rss usage is added to this counter every time | ||
136 | * a tick is charged to a task's system time. So, at the end we | ||
137 | * will have memory usage multiplied by system time. Thus an | ||
138 | * average usage per system time unit can be calculated. | ||
139 | */ | ||
140 | __u64 coremem; /* accumulated RSS usage in MB-usec */ | ||
141 | |||
142 | /* Accumulated virtual memory usage in duration of a task. | ||
143 | * Same as acct_rss_mem1 above except that we keep track of VM usage. | ||
144 | */ | ||
145 | __u64 virtmem; /* accumulated VM usage in MB-usec */ | ||
146 | |||
147 | /* High watermark of RSS usage in duration of a task, in KBytes. */ | ||
148 | __u64 hiwater_rss; /* High-watermark of RSS usage */ | ||
149 | |||
150 | /* High watermark of VM usage in duration of a task, in KBytes. */ | ||
151 | __u64 hiwater_vm; /* High-water virtual memory usage */ | ||
152 | |||
153 | /* The following four fields are I/O statistics of a task. */ | ||
154 | __u64 read_char; /* bytes read */ | ||
155 | __u64 write_char; /* bytes written */ | ||
156 | __u64 read_syscalls; /* read syscalls */ | ||
157 | __u64 write_syscalls; /* write syscalls */ | ||
158 | |||
159 | /* Extended accounting fields end */ | ||
160 | |||
161 | } | ||