Back to home page

OSCL-LXR

 
 

    


0001 ====================
0002 The struct taskstats
0003 ====================
0004 
0005 This document contains an explanation of the struct taskstats fields.
0006 
0007 There are three different groups of fields in the struct taskstats:
0008 
0009 1) Common and basic accounting fields
0010     If CONFIG_TASKSTATS is set, the taskstats interface is enabled and
0011     the common fields and basic accounting fields are collected for
0012     delivery at do_exit() of a task.
0013 2) Delay accounting fields
0014     These fields are placed between::
0015 
0016         /* Delay accounting fields start */
0017 
0018     and::
0019 
0020         /* Delay accounting fields end */
0021 
0022     Their values are collected if CONFIG_TASK_DELAY_ACCT is set.
0023 3) Extended accounting fields
0024     These fields are placed between::
0025 
0026         /* Extended accounting fields start */
0027 
0028     and::
0029 
0030         /* Extended accounting fields end */
0031 
0032     Their values are collected if CONFIG_TASK_XACCT is set.
0033 
0034 4) Per-task and per-thread context switch count statistics
0035 
0036 5) Time accounting for SMT machines
0037 
0038 6) Extended delay accounting fields for memory reclaim
0039 
0040 Future extension should add fields to the end of the taskstats struct, and
0041 should not change the relative position of each field within the struct.
0042 
0043 ::
0044 
0045   struct taskstats {
0046 
0047 1) Common and basic accounting fields::
0048 
0049         /* The version number of this struct. This field is always set to
0050          * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
0051          * Each time the struct is changed, the value should be incremented.
0052          */
0053         __u16   version;
0054 
0055         /* The exit code of a task. */
0056         __u32   ac_exitcode;            /* Exit status */
0057 
0058         /* The accounting flags of a task as defined in <linux/acct.h>
0059          * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
0060          */
0061         __u8    ac_flag;                /* Record flags */
0062 
0063         /* The value of task_nice() of a task. */
0064         __u8    ac_nice;                /* task_nice */
0065 
0066         /* The name of the command that started this task. */
0067         char    ac_comm[TS_COMM_LEN];   /* Command name */
0068 
0069         /* The scheduling discipline as set in task->policy field. */
0070         __u8    ac_sched;               /* Scheduling discipline */
0071 
0072         __u8    ac_pad[3];
0073         __u32   ac_uid;                 /* User ID */
0074         __u32   ac_gid;                 /* Group ID */
0075         __u32   ac_pid;                 /* Process ID */
0076         __u32   ac_ppid;                /* Parent process ID */
0077 
0078         /* The time when a task begins, in [secs] since 1970. */
0079         __u32   ac_btime;               /* Begin time [sec since 1970] */
0080 
0081         /* The elapsed time of a task, in [usec]. */
0082         __u64   ac_etime;               /* Elapsed time [usec] */
0083 
0084         /* The user CPU time of a task, in [usec]. */
0085         __u64   ac_utime;               /* User CPU time [usec] */
0086 
0087         /* The system CPU time of a task, in [usec]. */
0088         __u64   ac_stime;               /* System CPU time [usec] */
0089 
0090         /* The minor page fault count of a task, as set in task->min_flt. */
0091         __u64   ac_minflt;              /* Minor Page Fault Count */
0092 
0093         /* The major page fault count of a task, as set in task->maj_flt. */
0094         __u64   ac_majflt;              /* Major Page Fault Count */
0095 
0096 
0097 2) Delay accounting fields::
0098 
0099         /* Delay accounting fields start
0100          *
0101          * All values, until the comment "Delay accounting fields end" are
0102          * available only if delay accounting is enabled, even though the last
0103          * few fields are not delays
0104          *
0105          * xxx_count is the number of delay values recorded
0106          * xxx_delay_total is the corresponding cumulative delay in nanoseconds
0107          *
0108          * xxx_delay_total wraps around to zero on overflow
0109          * xxx_count incremented regardless of overflow
0110          */
0111 
0112         /* Delay waiting for cpu, while runnable
0113          * count, delay_total NOT updated atomically
0114          */
0115         __u64   cpu_count;
0116         __u64   cpu_delay_total;
0117 
0118         /* Following four fields atomically updated using task->delays->lock */
0119 
0120         /* Delay waiting for synchronous block I/O to complete
0121          * does not account for delays in I/O submission
0122          */
0123         __u64   blkio_count;
0124         __u64   blkio_delay_total;
0125 
0126         /* Delay waiting for page fault I/O (swap in only) */
0127         __u64   swapin_count;
0128         __u64   swapin_delay_total;
0129 
0130         /* cpu "wall-clock" running time
0131          * On some architectures, value will adjust for cpu time stolen
0132          * from the kernel in involuntary waits due to virtualization.
0133          * Value is cumulative, in nanoseconds, without a corresponding count
0134          * and wraps around to zero silently on overflow
0135          */
0136         __u64   cpu_run_real_total;
0137 
0138         /* cpu "virtual" running time
0139          * Uses time intervals seen by the kernel i.e. no adjustment
0140          * for kernel's involuntary waits due to virtualization.
0141          * Value is cumulative, in nanoseconds, without a corresponding count
0142          * and wraps around to zero silently on overflow
0143          */
0144         __u64   cpu_run_virtual_total;
0145         /* Delay accounting fields end */
0146         /* version 1 ends here */
0147 
0148 
0149 3) Extended accounting fields::
0150 
0151         /* Extended accounting fields start */
0152 
0153         /* Accumulated RSS usage in duration of a task, in MBytes-usecs.
0154          * The current rss usage is added to this counter every time
0155          * a tick is charged to a task's system time. So, at the end we
0156          * will have memory usage multiplied by system time. Thus an
0157          * average usage per system time unit can be calculated.
0158          */
0159         __u64   coremem;                /* accumulated RSS usage in MB-usec */
0160 
0161         /* Accumulated virtual memory usage in duration of a task.
0162          * Same as acct_rss_mem1 above except that we keep track of VM usage.
0163          */
0164         __u64   virtmem;                /* accumulated VM usage in MB-usec */
0165 
0166         /* High watermark of RSS usage in duration of a task, in KBytes. */
0167         __u64   hiwater_rss;            /* High-watermark of RSS usage */
0168 
0169         /* High watermark of VM  usage in duration of a task, in KBytes. */
0170         __u64   hiwater_vm;             /* High-water virtual memory usage */
0171 
0172         /* The following four fields are I/O statistics of a task. */
0173         __u64   read_char;              /* bytes read */
0174         __u64   write_char;             /* bytes written */
0175         __u64   read_syscalls;          /* read syscalls */
0176         __u64   write_syscalls;         /* write syscalls */
0177 
0178         /* Extended accounting fields end */
0179 
0180 4) Per-task and per-thread statistics::
0181 
0182         __u64   nvcsw;                  /* Context voluntary switch counter */
0183         __u64   nivcsw;                 /* Context involuntary switch counter */
0184 
0185 5) Time accounting for SMT machines::
0186 
0187         __u64   ac_utimescaled;         /* utime scaled on frequency etc */
0188         __u64   ac_stimescaled;         /* stime scaled on frequency etc */
0189         __u64   cpu_scaled_run_real_total; /* scaled cpu_run_real_total */
0190 
0191 6) Extended delay accounting fields for memory reclaim::
0192 
0193         /* Delay waiting for memory reclaim */
0194         __u64   freepages_count;
0195         __u64   freepages_delay_total;
0196 
0197 ::
0198 
0199   }