4 This document contains an explanation of the struct taskstats fields.
6 There are three different groups of fields in the struct taskstats:
8 1) Common and basic accounting fields
9 If CONFIG_TASKSTATS is set, the taskstats interface 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 */
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 */
22 /* Extended accounting fields end */
23 Their values are collected if CONFIG_TASK_XACCT is set.
25 4) Per-task and per-thread context switch count statistics
27 5) Time accounting for SMT machines
29 6) Extended delay accounting fields for memory reclaim
31 Future extension should add fields to the end of the taskstats struct, and
32 should not change the relative position of each field within the struct.
37 1) 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.
44 /* The exit code of a task. */
45 __u32 ac_exitcode; /* Exit status */
47 /* The accounting flags of a task as defined in <linux/acct.h>
48 * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
50 __u8 ac_flag; /* Record flags */
52 /* The value of task_nice() of a task. */
53 __u8 ac_nice; /* task_nice */
55 /* The name of the command that started this task. */
56 char ac_comm[TS_COMM_LEN]; /* Command name */
58 /* The scheduling discipline as set in task->policy field. */
59 __u8 ac_sched; /* Scheduling discipline */
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 */
67 /* The time when a task begins, in [secs] since 1970. */
68 __u32 ac_btime; /* Begin time [sec since 1970] */
70 /* The elapsed time of a task, in [usec]. */
71 __u64 ac_etime; /* Elapsed time [usec] */
73 /* The user CPU time of a task, in [usec]. */
74 __u64 ac_utime; /* User CPU time [usec] */
76 /* The system CPU time of a task, in [usec]. */
77 __u64 ac_stime; /* System CPU time [usec] */
79 /* The minor page fault count of a task, as set in task->min_flt. */
80 __u64 ac_minflt; /* Minor Page Fault Count */
82 /* The major page fault count of a task, as set in task->maj_flt. */
83 __u64 ac_majflt; /* Major Page Fault Count */
86 2) Delay accounting fields:
87 /* Delay accounting fields start
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
93 * xxx_count is the number of delay values recorded
94 * xxx_delay_total is the corresponding cumulative delay in nanoseconds
96 * xxx_delay_total wraps around to zero on overflow
97 * xxx_count incremented regardless of overflow
100 /* Delay waiting for cpu, while runnable
101 * count, delay_total NOT updated atomically
104 __u64 cpu_delay_total;
106 /* Following four fields atomically updated using task->delays->lock */
108 /* Delay waiting for synchronous block I/O to complete
109 * does not account for delays in I/O submission
112 __u64 blkio_delay_total;
114 /* Delay waiting for page fault I/O (swap in only) */
116 __u64 swapin_delay_total;
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
124 __u64 cpu_run_real_total;
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
132 __u64 cpu_run_virtual_total;
133 /* Delay accounting fields end */
134 /* version 1 ends here */
137 3) Extended accounting fields
138 /* Extended accounting fields start */
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.
146 __u64 coremem; /* accumulated RSS usage in MB-usec */
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.
151 __u64 virtmem; /* accumulated VM usage in MB-usec */
153 /* High watermark of RSS usage in duration of a task, in KBytes. */
154 __u64 hiwater_rss; /* High-watermark of RSS usage */
156 /* High watermark of VM usage in duration of a task, in KBytes. */
157 __u64 hiwater_vm; /* High-water virtual memory usage */
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 */
165 /* Extended accounting fields end */
167 4) Per-task and per-thread statistics
168 __u64 nvcsw; /* Context voluntary switch counter */
169 __u64 nivcsw; /* Context involuntary switch counter */
171 5) 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 */
176 6) Extended delay accounting fields for memory reclaim
177 /* Delay waiting for memory reclaim */
178 __u64 freepages_count;
179 __u64 freepages_delay_total;