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 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 */
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 Future extension should add fields to the end of the taskstats struct, and
30 should not change the relative position of each field within the struct.
35 1) Common and basic accounting fields:
36 /* The version number of this struct. This field is always set to
37 * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
38 * Each time the struct is changed, the value should be incremented.
42 /* The exit code of a task. */
43 __u32 ac_exitcode; /* Exit status */
45 /* The accounting flags of a task as defined in <linux/acct.h>
46 * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
48 __u8 ac_flag; /* Record flags */
50 /* The value of task_nice() of a task. */
51 __u8 ac_nice; /* task_nice */
53 /* The name of the command that started this task. */
54 char ac_comm[TS_COMM_LEN]; /* Command name */
56 /* The scheduling discipline as set in task->policy field. */
57 __u8 ac_sched; /* Scheduling discipline */
60 __u32 ac_uid; /* User ID */
61 __u32 ac_gid; /* Group ID */
62 __u32 ac_pid; /* Process ID */
63 __u32 ac_ppid; /* Parent process ID */
65 /* The time when a task begins, in [secs] since 1970. */
66 __u32 ac_btime; /* Begin time [sec since 1970] */
68 /* The elapsed time of a task, in [usec]. */
69 __u64 ac_etime; /* Elapsed time [usec] */
71 /* The user CPU time of a task, in [usec]. */
72 __u64 ac_utime; /* User CPU time [usec] */
74 /* The system CPU time of a task, in [usec]. */
75 __u64 ac_stime; /* System CPU time [usec] */
77 /* The minor page fault count of a task, as set in task->min_flt. */
78 __u64 ac_minflt; /* Minor Page Fault Count */
80 /* The major page fault count of a task, as set in task->maj_flt. */
81 __u64 ac_majflt; /* Major Page Fault Count */
84 2) Delay accounting fields:
85 /* Delay accounting fields start
87 * All values, until the comment "Delay accounting fields end" are
88 * available only if delay accounting is enabled, even though the last
89 * few fields are not delays
91 * xxx_count is the number of delay values recorded
92 * xxx_delay_total is the corresponding cumulative delay in nanoseconds
94 * xxx_delay_total wraps around to zero on overflow
95 * xxx_count incremented regardless of overflow
98 /* Delay waiting for cpu, while runnable
99 * count, delay_total NOT updated atomically
102 __u64 cpu_delay_total;
104 /* Following four fields atomically updated using task->delays->lock */
106 /* Delay waiting for synchronous block I/O to complete
107 * does not account for delays in I/O submission
110 __u64 blkio_delay_total;
112 /* Delay waiting for page fault I/O (swap in only) */
114 __u64 swapin_delay_total;
116 /* cpu "wall-clock" running time
117 * On some architectures, value will adjust for cpu time stolen
118 * from the kernel in involuntary waits due to virtualization.
119 * Value is cumulative, in nanoseconds, without a corresponding count
120 * and wraps around to zero silently on overflow
122 __u64 cpu_run_real_total;
124 /* cpu "virtual" running time
125 * Uses time intervals seen by the kernel i.e. no adjustment
126 * for kernel's involuntary waits due to virtualization.
127 * Value is cumulative, in nanoseconds, without a corresponding count
128 * and wraps around to zero silently on overflow
130 __u64 cpu_run_virtual_total;
131 /* Delay accounting fields end */
132 /* version 1 ends here */
135 3) Extended accounting fields
136 /* Extended accounting fields start */
138 /* Accumulated RSS usage in duration of a task, in MBytes-usecs.
139 * The current rss usage is added to this counter every time
140 * a tick is charged to a task's system time. So, at the end we
141 * will have memory usage multiplied by system time. Thus an
142 * average usage per system time unit can be calculated.
144 __u64 coremem; /* accumulated RSS usage in MB-usec */
146 /* Accumulated virtual memory usage in duration of a task.
147 * Same as acct_rss_mem1 above except that we keep track of VM usage.
149 __u64 virtmem; /* accumulated VM usage in MB-usec */
151 /* High watermark of RSS usage in duration of a task, in KBytes. */
152 __u64 hiwater_rss; /* High-watermark of RSS usage */
154 /* High watermark of VM usage in duration of a task, in KBytes. */
155 __u64 hiwater_vm; /* High-water virtual memory usage */
157 /* The following four fields are I/O statistics of a task. */
158 __u64 read_char; /* bytes read */
159 __u64 write_char; /* bytes written */
160 __u64 read_syscalls; /* read syscalls */
161 __u64 write_syscalls; /* write syscalls */
163 /* Extended accounting fields end */
165 4) Per-task and per-thread statistics
166 __u64 nvcsw; /* Context voluntary switch counter */
167 __u64 nivcsw; /* Context involuntary switch counter */
169 5) Time accounting for SMT machines
170 __u64 ac_utimescaled; /* utime scaled on frequency etc */
171 __u64 ac_stimescaled; /* stime scaled on frequency etc */
172 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */