Documentation/accounting/taskstats-struct.rst
This document contains an explanation of the struct taskstats fields.
There are three different groups of fields in the struct taskstats:
Common and basic accounting fields If CONFIG_TASKSTATS is set, the taskstats interface is enabled and the common fields and basic accounting fields are collected for delivery at do_exit() of a task.
Delay accounting fields These fields are placed between::
/* Delay accounting fields start */
and::
/* Delay accounting fields end */
Their values are collected if CONFIG_TASK_DELAY_ACCT is set.
Extended accounting fields These fields are placed between::
/* Extended accounting fields start */
and::
/* Extended accounting fields end */
Their values are collected if CONFIG_TASK_XACCT is set.
Per-task and per-thread context switch count statistics
Time accounting for SMT machines
Extended delay accounting fields for memory reclaim
Future extension should add fields to the end of the taskstats struct, and should not change the relative position of each field within the struct.
::
struct taskstats {
Common and basic accounting fields::
/* The version number of this struct. This field is always set to
/* The exit code of a task. / __u32 ac_exitcode; / Exit status */
/* The accounting flags of a task as defined in <linux/acct.h>
/* The value of task_nice() of a task. / __u8 ac_nice; / task_nice */
/* The name of the command that started this task. / char ac_comm[TS_COMM_LEN]; / Command name */
/* The scheduling discipline as set in task->policy field. / __u8 ac_sched; / Scheduling discipline */
__u8 ac_pad[3]; __u32 ac_uid; /* User ID / __u32 ac_gid; / Group ID / __u32 ac_pid; / Process ID / __u32 ac_ppid; / Parent process ID */
/* The time when a task begins, in [secs] since 1970. / __u32 ac_btime; / Begin time [sec since 1970] */
/* The elapsed time of a task, in [usec]. / __u64 ac_etime; / Elapsed time [usec] */
/* The user CPU time of a task, in [usec]. / __u64 ac_utime; / User CPU time [usec] */
/* The system CPU time of a task, in [usec]. / __u64 ac_stime; / System CPU time [usec] */
/* The minor page fault count of a task, as set in task->min_flt. / __u64 ac_minflt; / Minor Page Fault Count */
/* The major page fault count of a task, as set in task->maj_flt. / __u64 ac_majflt; / Major Page Fault Count */
Delay accounting fields::
/* Delay accounting fields start *
/* Delay waiting for cpu, while runnable
/* Following four fields atomically updated using task->delays->lock */
/* Delay waiting for synchronous block I/O to complete
/* Delay waiting for page fault I/O (swap in only) */ __u64 swapin_count; __u64 swapin_delay_total;
/* cpu "wall-clock" running time
/* cpu "virtual" running time
Extended accounting fields::
/* Extended accounting fields start */
/* Accumulated RSS usage in duration of a task, in MBytes-usecs.
/* Accumulated virtual memory usage in duration of a task.
/* High watermark of RSS usage in duration of a task, in KBytes. / __u64 hiwater_rss; / High-watermark of RSS usage */
/* High watermark of VM usage in duration of a task, in KBytes. / __u64 hiwater_vm; / High-water virtual memory usage */
/* The following four fields are I/O statistics of a task. / __u64 read_char; / bytes read / __u64 write_char; / bytes written / __u64 read_syscalls; / read syscalls / __u64 write_syscalls; / write syscalls */
/* Extended accounting fields end */
Per-task and per-thread statistics::
__u64 nvcsw; /* Context voluntary switch counter / __u64 nivcsw; / Context involuntary switch counter */
Time accounting for SMT machines::
__u64 ac_utimescaled; /* utime scaled on frequency etc / __u64 ac_stimescaled; / stime scaled on frequency etc / __u64 cpu_scaled_run_real_total; / scaled cpu_run_real_total */
Extended delay accounting fields for memory reclaim::
/* Delay waiting for memory reclaim */ __u64 freepages_count; __u64 freepages_delay_total;
::
}