1 ==================== 1 ==================== 2 The struct taskstats 2 The struct taskstats 3 ==================== 3 ==================== 4 4 5 This document contains an explanation of the s 5 This document contains an explanation of the struct taskstats fields. 6 6 7 There are three different groups of fields in 7 There are three different groups of fields in the struct taskstats: 8 8 9 1) Common and basic accounting fields 9 1) Common and basic accounting fields 10 If CONFIG_TASKSTATS is set, the taskstats 10 If CONFIG_TASKSTATS is set, the taskstats interface is enabled and 11 the common fields and basic accounting fie 11 the common fields and basic accounting fields are collected for 12 delivery at do_exit() of a task. 12 delivery at do_exit() of a task. 13 2) Delay accounting fields 13 2) Delay accounting fields 14 These fields are placed between:: 14 These fields are placed between:: 15 15 16 /* Delay accounting fields start */ 16 /* Delay accounting fields start */ 17 17 18 and:: 18 and:: 19 19 20 /* Delay accounting fields end */ 20 /* Delay accounting fields end */ 21 21 22 Their values are collected if CONFIG_TASK_ 22 Their values are collected if CONFIG_TASK_DELAY_ACCT is set. 23 3) Extended accounting fields 23 3) Extended accounting fields 24 These fields are placed between:: 24 These fields are placed between:: 25 25 26 /* Extended accounting fields start */ 26 /* Extended accounting fields start */ 27 27 28 and:: 28 and:: 29 29 30 /* Extended accounting fields end */ 30 /* Extended accounting fields end */ 31 31 32 Their values are collected if CONFIG_TASK_ 32 Their values are collected if CONFIG_TASK_XACCT is set. 33 33 34 4) Per-task and per-thread context switch coun 34 4) Per-task and per-thread context switch count statistics 35 35 36 5) Time accounting for SMT machines 36 5) Time accounting for SMT machines 37 37 38 6) Extended delay accounting fields for memory 38 6) Extended delay accounting fields for memory reclaim 39 39 40 Future extension should add fields to the end 40 Future extension should add fields to the end of the taskstats struct, and 41 should not change the relative position of eac 41 should not change the relative position of each field within the struct. 42 42 43 :: 43 :: 44 44 45 struct taskstats { 45 struct taskstats { 46 46 47 1) Common and basic accounting fields:: 47 1) Common and basic accounting fields:: 48 48 49 /* The version number of this struct. 49 /* The version number of this struct. This field is always set to 50 * TAKSTATS_VERSION, which is defined 50 * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>. 51 * Each time the struct is changed, th 51 * Each time the struct is changed, the value should be incremented. 52 */ 52 */ 53 __u16 version; 53 __u16 version; 54 54 55 /* The exit code of a task. */ 55 /* The exit code of a task. */ 56 __u32 ac_exitcode; /* Exi 56 __u32 ac_exitcode; /* Exit status */ 57 57 58 /* The accounting flags of a task as d 58 /* The accounting flags of a task as defined in <linux/acct.h> 59 * Defined values are AFORK, ASU, ACOM 59 * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG. 60 */ 60 */ 61 __u8 ac_flag; /* Rec 61 __u8 ac_flag; /* Record flags */ 62 62 63 /* The value of task_nice() of a task. 63 /* The value of task_nice() of a task. */ 64 __u8 ac_nice; /* tas 64 __u8 ac_nice; /* task_nice */ 65 65 66 /* The name of the command that starte 66 /* The name of the command that started this task. */ 67 char ac_comm[TS_COMM_LEN]; /* Com 67 char ac_comm[TS_COMM_LEN]; /* Command name */ 68 68 69 /* The scheduling discipline as set in 69 /* The scheduling discipline as set in task->policy field. */ 70 __u8 ac_sched; /* Sch 70 __u8 ac_sched; /* Scheduling discipline */ 71 71 72 __u8 ac_pad[3]; 72 __u8 ac_pad[3]; 73 __u32 ac_uid; /* Use 73 __u32 ac_uid; /* User ID */ 74 __u32 ac_gid; /* Gro 74 __u32 ac_gid; /* Group ID */ 75 __u32 ac_pid; /* Pro 75 __u32 ac_pid; /* Process ID */ 76 __u32 ac_ppid; /* Par 76 __u32 ac_ppid; /* Parent process ID */ 77 77 78 /* The time when a task begins, in [se 78 /* The time when a task begins, in [secs] since 1970. */ 79 __u32 ac_btime; /* Beg 79 __u32 ac_btime; /* Begin time [sec since 1970] */ 80 80 81 /* The elapsed time of a task, in [use 81 /* The elapsed time of a task, in [usec]. */ 82 __u64 ac_etime; /* Ela 82 __u64 ac_etime; /* Elapsed time [usec] */ 83 83 84 /* The user CPU time of a task, in [us 84 /* The user CPU time of a task, in [usec]. */ 85 __u64 ac_utime; /* Use 85 __u64 ac_utime; /* User CPU time [usec] */ 86 86 87 /* The system CPU time of a task, in [ 87 /* The system CPU time of a task, in [usec]. */ 88 __u64 ac_stime; /* Sys 88 __u64 ac_stime; /* System CPU time [usec] */ 89 89 90 /* The minor page fault count of a tas 90 /* The minor page fault count of a task, as set in task->min_flt. */ 91 __u64 ac_minflt; /* Min 91 __u64 ac_minflt; /* Minor Page Fault Count */ 92 92 93 /* The major page fault count of a tas 93 /* The major page fault count of a task, as set in task->maj_flt. */ 94 __u64 ac_majflt; /* Maj 94 __u64 ac_majflt; /* Major Page Fault Count */ 95 95 96 96 97 2) Delay accounting fields:: 97 2) Delay accounting fields:: 98 98 99 /* Delay accounting fields start 99 /* Delay accounting fields start 100 * 100 * 101 * All values, until the comment "Dela 101 * All values, until the comment "Delay accounting fields end" are 102 * available only if delay accounting 102 * available only if delay accounting is enabled, even though the last 103 * few fields are not delays 103 * few fields are not delays 104 * 104 * 105 * xxx_count is the number of delay va 105 * xxx_count is the number of delay values recorded 106 * xxx_delay_total is the correspondin 106 * xxx_delay_total is the corresponding cumulative delay in nanoseconds 107 * 107 * 108 * xxx_delay_total wraps around to zer 108 * xxx_delay_total wraps around to zero on overflow 109 * xxx_count incremented regardless of 109 * xxx_count incremented regardless of overflow 110 */ 110 */ 111 111 112 /* Delay waiting for cpu, while runnab 112 /* Delay waiting for cpu, while runnable 113 * count, delay_total NOT updated atom 113 * count, delay_total NOT updated atomically 114 */ 114 */ 115 __u64 cpu_count; 115 __u64 cpu_count; 116 __u64 cpu_delay_total; 116 __u64 cpu_delay_total; 117 117 118 /* Following four fields atomically up 118 /* Following four fields atomically updated using task->delays->lock */ 119 119 120 /* Delay waiting for synchronous block 120 /* Delay waiting for synchronous block I/O to complete 121 * does not account for delays in I/O 121 * does not account for delays in I/O submission 122 */ 122 */ 123 __u64 blkio_count; 123 __u64 blkio_count; 124 __u64 blkio_delay_total; 124 __u64 blkio_delay_total; 125 125 126 /* Delay waiting for page fault I/O (s 126 /* Delay waiting for page fault I/O (swap in only) */ 127 __u64 swapin_count; 127 __u64 swapin_count; 128 __u64 swapin_delay_total; 128 __u64 swapin_delay_total; 129 129 130 /* cpu "wall-clock" running time 130 /* cpu "wall-clock" running time 131 * On some architectures, value will a 131 * On some architectures, value will adjust for cpu time stolen 132 * from the kernel in involuntary wait 132 * from the kernel in involuntary waits due to virtualization. 133 * Value is cumulative, in nanoseconds 133 * Value is cumulative, in nanoseconds, without a corresponding count 134 * and wraps around to zero silently o 134 * and wraps around to zero silently on overflow 135 */ 135 */ 136 __u64 cpu_run_real_total; 136 __u64 cpu_run_real_total; 137 137 138 /* cpu "virtual" running time 138 /* cpu "virtual" running time 139 * Uses time intervals seen by the ker 139 * Uses time intervals seen by the kernel i.e. no adjustment 140 * for kernel's involuntary waits due 140 * for kernel's involuntary waits due to virtualization. 141 * Value is cumulative, in nanoseconds 141 * Value is cumulative, in nanoseconds, without a corresponding count 142 * and wraps around to zero silently o 142 * and wraps around to zero silently on overflow 143 */ 143 */ 144 __u64 cpu_run_virtual_total; 144 __u64 cpu_run_virtual_total; 145 /* Delay accounting fields end */ 145 /* Delay accounting fields end */ 146 /* version 1 ends here */ 146 /* version 1 ends here */ 147 147 148 148 149 3) Extended accounting fields:: 149 3) Extended accounting fields:: 150 150 151 /* Extended accounting fields start */ 151 /* Extended accounting fields start */ 152 152 153 /* Accumulated RSS usage in duration o 153 /* Accumulated RSS usage in duration of a task, in MBytes-usecs. 154 * The current rss usage is added to t 154 * The current rss usage is added to this counter every time 155 * a tick is charged to a task's syste 155 * a tick is charged to a task's system time. So, at the end we 156 * will have memory usage multiplied b 156 * will have memory usage multiplied by system time. Thus an 157 * average usage per system time unit 157 * average usage per system time unit can be calculated. 158 */ 158 */ 159 __u64 coremem; /* acc 159 __u64 coremem; /* accumulated RSS usage in MB-usec */ 160 160 161 /* Accumulated virtual memory usage in 161 /* Accumulated virtual memory usage in duration of a task. 162 * Same as acct_rss_mem1 above except 162 * Same as acct_rss_mem1 above except that we keep track of VM usage. 163 */ 163 */ 164 __u64 virtmem; /* acc 164 __u64 virtmem; /* accumulated VM usage in MB-usec */ 165 165 166 /* High watermark of RSS usage in dura 166 /* High watermark of RSS usage in duration of a task, in KBytes. */ 167 __u64 hiwater_rss; /* Hig 167 __u64 hiwater_rss; /* High-watermark of RSS usage */ 168 168 169 /* High watermark of VM usage in dura 169 /* High watermark of VM usage in duration of a task, in KBytes. */ 170 __u64 hiwater_vm; /* Hig 170 __u64 hiwater_vm; /* High-water virtual memory usage */ 171 171 172 /* The following four fields are I/O s 172 /* The following four fields are I/O statistics of a task. */ 173 __u64 read_char; /* byt 173 __u64 read_char; /* bytes read */ 174 __u64 write_char; /* byt 174 __u64 write_char; /* bytes written */ 175 __u64 read_syscalls; /* rea 175 __u64 read_syscalls; /* read syscalls */ 176 __u64 write_syscalls; /* wri 176 __u64 write_syscalls; /* write syscalls */ 177 177 178 /* Extended accounting fields end */ 178 /* Extended accounting fields end */ 179 179 180 4) Per-task and per-thread statistics:: 180 4) Per-task and per-thread statistics:: 181 181 182 __u64 nvcsw; /* Con 182 __u64 nvcsw; /* Context voluntary switch counter */ 183 __u64 nivcsw; /* Con 183 __u64 nivcsw; /* Context involuntary switch counter */ 184 184 185 5) Time accounting for SMT machines:: 185 5) Time accounting for SMT machines:: 186 186 187 __u64 ac_utimescaled; /* uti 187 __u64 ac_utimescaled; /* utime scaled on frequency etc */ 188 __u64 ac_stimescaled; /* sti 188 __u64 ac_stimescaled; /* stime scaled on frequency etc */ 189 __u64 cpu_scaled_run_real_total; /* 189 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ 190 190 191 6) Extended delay accounting fields for memory 191 6) Extended delay accounting fields for memory reclaim:: 192 192 193 /* Delay waiting for memory reclaim */ 193 /* Delay waiting for memory reclaim */ 194 __u64 freepages_count; 194 __u64 freepages_count; 195 __u64 freepages_delay_total; 195 __u64 freepages_delay_total; 196 196 197 :: 197 :: 198 198 199 } 199 }
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.