blob: ca90fd489c9a3c5e4efbc5fa2facee9254985a21 [file] [log] [blame]
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -03001====================
Jay Landb5fed262006-09-30 23:29:00 -07002The struct taskstats
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -03003====================
Jay Landb5fed262006-09-30 23:29:00 -07004
5This document contains an explanation of the struct taskstats fields.
6
7There are three different groups of fields in the struct taskstats:
8
91) Common and basic accounting fields
Matt LaPlanted9195882008-07-25 19:45:33 -070010 If CONFIG_TASKSTATS is set, the taskstats interface is enabled and
Jay Landb5fed262006-09-30 23:29:00 -070011 the common fields and basic accounting fields are collected for
12 delivery at do_exit() of a task.
132) Delay accounting fields
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030014 These fields are placed between::
15
16 /* Delay accounting fields start */
17
18 and::
19
20 /* Delay accounting fields end */
21
Jay Landb5fed262006-09-30 23:29:00 -070022 Their values are collected if CONFIG_TASK_DELAY_ACCT is set.
233) Extended accounting fields
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030024 These fields are placed between::
25
26 /* Extended accounting fields start */
27
28 and::
29
30 /* Extended accounting fields end */
31
Jay Landb5fed262006-09-30 23:29:00 -070032 Their values are collected if CONFIG_TASK_XACCT is set.
33
Maxim Uvarovb663a792007-07-15 23:40:48 -0700344) Per-task and per-thread context switch count statistics
35
Hiroshi Shimamotof93f18c2008-07-04 09:59:39 -0700365) Time accounting for SMT machines
37
Keika Kobayashi016ae212008-07-25 01:48:53 -0700386) Extended delay accounting fields for memory reclaim
39
Jay Landb5fed262006-09-30 23:29:00 -070040Future extension should add fields to the end of the taskstats struct, and
41should not change the relative position of each field within the struct.
42
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030043::
Jay Landb5fed262006-09-30 23:29:00 -070044
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030045 struct taskstats {
Jay Landb5fed262006-09-30 23:29:00 -070046
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -0300471) Common and basic accounting fields::
48
Jay Landb5fed262006-09-30 23:29:00 -070049 /* The version number of this struct. This field is always set to
50 * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
51 * Each time the struct is changed, the value should be incremented.
52 */
53 __u16 version;
54
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030055 /* The exit code of a task. */
Jay Landb5fed262006-09-30 23:29:00 -070056 __u32 ac_exitcode; /* Exit status */
57
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030058 /* The accounting flags of a task as defined in <linux/acct.h>
Jay Landb5fed262006-09-30 23:29:00 -070059 * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
60 */
61 __u8 ac_flag; /* Record flags */
62
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030063 /* The value of task_nice() of a task. */
Jay Landb5fed262006-09-30 23:29:00 -070064 __u8 ac_nice; /* task_nice */
65
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030066 /* The name of the command that started this task. */
Jay Landb5fed262006-09-30 23:29:00 -070067 char ac_comm[TS_COMM_LEN]; /* Command name */
68
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030069 /* The scheduling discipline as set in task->policy field. */
Jay Landb5fed262006-09-30 23:29:00 -070070 __u8 ac_sched; /* Scheduling discipline */
71
72 __u8 ac_pad[3];
73 __u32 ac_uid; /* User ID */
74 __u32 ac_gid; /* Group ID */
75 __u32 ac_pid; /* Process ID */
76 __u32 ac_ppid; /* Parent process ID */
77
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030078 /* The time when a task begins, in [secs] since 1970. */
Jay Landb5fed262006-09-30 23:29:00 -070079 __u32 ac_btime; /* Begin time [sec since 1970] */
80
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030081 /* The elapsed time of a task, in [usec]. */
Jay Landb5fed262006-09-30 23:29:00 -070082 __u64 ac_etime; /* Elapsed time [usec] */
83
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030084 /* The user CPU time of a task, in [usec]. */
Jay Landb5fed262006-09-30 23:29:00 -070085 __u64 ac_utime; /* User CPU time [usec] */
86
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030087 /* The system CPU time of a task, in [usec]. */
Jay Landb5fed262006-09-30 23:29:00 -070088 __u64 ac_stime; /* System CPU time [usec] */
89
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -030090 /* The minor page fault count of a task, as set in task->min_flt. */
Jay Landb5fed262006-09-30 23:29:00 -070091 __u64 ac_minflt; /* Minor Page Fault Count */
92
93 /* The major page fault count of a task, as set in task->maj_flt. */
94 __u64 ac_majflt; /* Major Page Fault Count */
95
96
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -0300972) Delay accounting fields::
98
Jay Landb5fed262006-09-30 23:29:00 -070099 /* Delay accounting fields start
100 *
101 * All values, until the comment "Delay accounting fields end" are
102 * available only if delay accounting is enabled, even though the last
103 * few fields are not delays
104 *
105 * xxx_count is the number of delay values recorded
106 * xxx_delay_total is the corresponding cumulative delay in nanoseconds
107 *
108 * xxx_delay_total wraps around to zero on overflow
109 * xxx_count incremented regardless of overflow
110 */
111
112 /* Delay waiting for cpu, while runnable
113 * count, delay_total NOT updated atomically
114 */
115 __u64 cpu_count;
116 __u64 cpu_delay_total;
117
118 /* Following four fields atomically updated using task->delays->lock */
119
120 /* Delay waiting for synchronous block I/O to complete
121 * does not account for delays in I/O submission
122 */
123 __u64 blkio_count;
124 __u64 blkio_delay_total;
125
126 /* Delay waiting for page fault I/O (swap in only) */
127 __u64 swapin_count;
128 __u64 swapin_delay_total;
129
130 /* cpu "wall-clock" running time
131 * On some architectures, value will adjust for cpu time stolen
132 * from the kernel in involuntary waits due to virtualization.
133 * Value is cumulative, in nanoseconds, without a corresponding count
134 * and wraps around to zero silently on overflow
135 */
136 __u64 cpu_run_real_total;
137
138 /* cpu "virtual" running time
139 * Uses time intervals seen by the kernel i.e. no adjustment
140 * for kernel's involuntary waits due to virtualization.
141 * Value is cumulative, in nanoseconds, without a corresponding count
142 * and wraps around to zero silently on overflow
143 */
144 __u64 cpu_run_virtual_total;
145 /* Delay accounting fields end */
146 /* version 1 ends here */
147
148
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -03001493) Extended accounting fields::
150
Jay Landb5fed262006-09-30 23:29:00 -0700151 /* Extended accounting fields start */
152
153 /* Accumulated RSS usage in duration of a task, in MBytes-usecs.
154 * The current rss usage is added to this counter every time
155 * a tick is charged to a task's system time. So, at the end we
156 * will have memory usage multiplied by system time. Thus an
157 * average usage per system time unit can be calculated.
158 */
159 __u64 coremem; /* accumulated RSS usage in MB-usec */
160
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -0300161 /* Accumulated virtual memory usage in duration of a task.
Jay Landb5fed262006-09-30 23:29:00 -0700162 * Same as acct_rss_mem1 above except that we keep track of VM usage.
163 */
164 __u64 virtmem; /* accumulated VM usage in MB-usec */
165
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -0300166 /* High watermark of RSS usage in duration of a task, in KBytes. */
Jay Landb5fed262006-09-30 23:29:00 -0700167 __u64 hiwater_rss; /* High-watermark of RSS usage */
168
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -0300169 /* High watermark of VM usage in duration of a task, in KBytes. */
Jay Landb5fed262006-09-30 23:29:00 -0700170 __u64 hiwater_vm; /* High-water virtual memory usage */
171
172 /* The following four fields are I/O statistics of a task. */
173 __u64 read_char; /* bytes read */
174 __u64 write_char; /* bytes written */
175 __u64 read_syscalls; /* read syscalls */
176 __u64 write_syscalls; /* write syscalls */
177
178 /* Extended accounting fields end */
179
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -03001804) Per-task and per-thread statistics::
181
Maxim Uvarovb663a792007-07-15 23:40:48 -0700182 __u64 nvcsw; /* Context voluntary switch counter */
183 __u64 nivcsw; /* Context involuntary switch counter */
184
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -03001855) Time accounting for SMT machines::
186
Hiroshi Shimamotof93f18c2008-07-04 09:59:39 -0700187 __u64 ac_utimescaled; /* utime scaled on frequency etc */
188 __u64 ac_stimescaled; /* stime scaled on frequency etc */
189 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */
Keika Kobayashi016ae212008-07-25 01:48:53 -0700190
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -03001916) Extended delay accounting fields for memory reclaim::
192
Keika Kobayashi016ae212008-07-25 01:48:53 -0700193 /* Delay waiting for memory reclaim */
194 __u64 freepages_count;
195 __u64 freepages_delay_total;
Mauro Carvalho Chehabc3123552019-04-17 05:46:08 -0300196
197::
198
199 }