blob: e7512c061c1572f5127b7bb861ded0f0515bc6af [file] [log] [blame]
Jay Landb5fed22006-09-30 23:29:00 -07001The struct taskstats
2--------------------
3
4This document contains an explanation of the struct taskstats fields.
5
6There are three different groups of fields in the struct taskstats:
7
81) Common and basic accounting fields
Matt LaPlanted9195882008-07-25 19:45:33 -07009 If CONFIG_TASKSTATS is set, the taskstats interface is enabled and
Jay Landb5fed22006-09-30 23:29:00 -070010 the common fields and basic accounting fields are collected for
11 delivery at do_exit() of a task.
122) 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.
183) 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
Maxim Uvarovb663a792007-07-15 23:40:48 -0700254) Per-task and per-thread context switch count statistics
26
Hiroshi Shimamotof93f18c2008-07-04 09:59:39 -0700275) Time accounting for SMT machines
28
Keika Kobayashi016ae212008-07-25 01:48:53 -0700296) Extended delay accounting fields for memory reclaim
30
Jay Landb5fed22006-09-30 23:29:00 -070031Future extension should add fields to the end of the taskstats struct, and
32should not change the relative position of each field within the struct.
33
34
35struct taskstats {
36
371) Common and basic accounting fields:
38 /* The version number of this struct. This field is always set to
39 * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
40 * Each time the struct is changed, the value should be incremented.
41 */
42 __u16 version;
43
44 /* The exit code of a task. */
45 __u32 ac_exitcode; /* Exit status */
46
47 /* The accounting flags of a task as defined in <linux/acct.h>
48 * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
49 */
50 __u8 ac_flag; /* Record flags */
51
52 /* The value of task_nice() of a task. */
53 __u8 ac_nice; /* task_nice */
54
55 /* The name of the command that started this task. */
56 char ac_comm[TS_COMM_LEN]; /* Command name */
57
58 /* The scheduling discipline as set in task->policy field. */
59 __u8 ac_sched; /* Scheduling discipline */
60
61 __u8 ac_pad[3];
62 __u32 ac_uid; /* User ID */
63 __u32 ac_gid; /* Group ID */
64 __u32 ac_pid; /* Process ID */
65 __u32 ac_ppid; /* Parent process ID */
66
67 /* The time when a task begins, in [secs] since 1970. */
68 __u32 ac_btime; /* Begin time [sec since 1970] */
69
70 /* The elapsed time of a task, in [usec]. */
71 __u64 ac_etime; /* Elapsed time [usec] */
72
73 /* The user CPU time of a task, in [usec]. */
74 __u64 ac_utime; /* User CPU time [usec] */
75
76 /* The system CPU time of a task, in [usec]. */
77 __u64 ac_stime; /* System CPU time [usec] */
78
79 /* The minor page fault count of a task, as set in task->min_flt. */
80 __u64 ac_minflt; /* Minor Page Fault Count */
81
82 /* The major page fault count of a task, as set in task->maj_flt. */
83 __u64 ac_majflt; /* Major Page Fault Count */
84
85
862) Delay accounting fields:
87 /* Delay accounting fields start
88 *
89 * All values, until the comment "Delay accounting fields end" are
90 * available only if delay accounting is enabled, even though the last
91 * few fields are not delays
92 *
93 * xxx_count is the number of delay values recorded
94 * xxx_delay_total is the corresponding cumulative delay in nanoseconds
95 *
96 * xxx_delay_total wraps around to zero on overflow
97 * xxx_count incremented regardless of overflow
98 */
99
100 /* Delay waiting for cpu, while runnable
101 * count, delay_total NOT updated atomically
102 */
103 __u64 cpu_count;
104 __u64 cpu_delay_total;
105
106 /* Following four fields atomically updated using task->delays->lock */
107
108 /* Delay waiting for synchronous block I/O to complete
109 * does not account for delays in I/O submission
110 */
111 __u64 blkio_count;
112 __u64 blkio_delay_total;
113
114 /* Delay waiting for page fault I/O (swap in only) */
115 __u64 swapin_count;
116 __u64 swapin_delay_total;
117
118 /* cpu "wall-clock" running time
119 * On some architectures, value will adjust for cpu time stolen
120 * from the kernel in involuntary waits due to virtualization.
121 * Value is cumulative, in nanoseconds, without a corresponding count
122 * and wraps around to zero silently on overflow
123 */
124 __u64 cpu_run_real_total;
125
126 /* cpu "virtual" running time
127 * Uses time intervals seen by the kernel i.e. no adjustment
128 * for kernel's involuntary waits due to virtualization.
129 * Value is cumulative, in nanoseconds, without a corresponding count
130 * and wraps around to zero silently on overflow
131 */
132 __u64 cpu_run_virtual_total;
133 /* Delay accounting fields end */
134 /* version 1 ends here */
135
136
1373) Extended accounting fields
138 /* Extended accounting fields start */
139
140 /* Accumulated RSS usage in duration of a task, in MBytes-usecs.
141 * The current rss usage is added to this counter every time
142 * a tick is charged to a task's system time. So, at the end we
143 * will have memory usage multiplied by system time. Thus an
144 * average usage per system time unit can be calculated.
145 */
146 __u64 coremem; /* accumulated RSS usage in MB-usec */
147
148 /* Accumulated virtual memory usage in duration of a task.
149 * Same as acct_rss_mem1 above except that we keep track of VM usage.
150 */
151 __u64 virtmem; /* accumulated VM usage in MB-usec */
152
153 /* High watermark of RSS usage in duration of a task, in KBytes. */
154 __u64 hiwater_rss; /* High-watermark of RSS usage */
155
156 /* High watermark of VM usage in duration of a task, in KBytes. */
157 __u64 hiwater_vm; /* High-water virtual memory usage */
158
159 /* The following four fields are I/O statistics of a task. */
160 __u64 read_char; /* bytes read */
161 __u64 write_char; /* bytes written */
162 __u64 read_syscalls; /* read syscalls */
163 __u64 write_syscalls; /* write syscalls */
164
165 /* Extended accounting fields end */
166
Maxim Uvarovb663a792007-07-15 23:40:48 -07001674) Per-task and per-thread statistics
168 __u64 nvcsw; /* Context voluntary switch counter */
169 __u64 nivcsw; /* Context involuntary switch counter */
170
Hiroshi Shimamotof93f18c2008-07-04 09:59:39 -07001715) Time accounting for SMT machines
172 __u64 ac_utimescaled; /* utime scaled on frequency etc */
173 __u64 ac_stimescaled; /* stime scaled on frequency etc */
174 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */
Keika Kobayashi016ae212008-07-25 01:48:53 -0700175
1766) Extended delay accounting fields for memory reclaim
177 /* Delay waiting for memory reclaim */
178 __u64 freepages_count;
179 __u64 freepages_delay_total;
Jay Landb5fed22006-09-30 23:29:00 -0700180}