taskstats-struct.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. The struct taskstats
  2. --------------------
  3. This document contains an explanation of the struct taskstats fields.
  4. There are three different groups of fields in the struct taskstats:
  5. 1) Common and basic accounting fields
  6. If CONFIG_TASKSTATS is set, the taskstats inteface is enabled and
  7. the common fields and basic accounting fields are collected for
  8. delivery at do_exit() of a task.
  9. 2) Delay accounting fields
  10. These fields are placed between
  11. /* Delay accounting fields start */
  12. and
  13. /* Delay accounting fields end */
  14. Their values are collected if CONFIG_TASK_DELAY_ACCT is set.
  15. 3) Extended accounting fields
  16. These fields are placed between
  17. /* Extended accounting fields start */
  18. and
  19. /* Extended accounting fields end */
  20. Their values are collected if CONFIG_TASK_XACCT is set.
  21. Future extension should add fields to the end of the taskstats struct, and
  22. should not change the relative position of each field within the struct.
  23. struct taskstats {
  24. 1) Common and basic accounting fields:
  25. /* The version number of this struct. This field is always set to
  26. * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
  27. * Each time the struct is changed, the value should be incremented.
  28. */
  29. __u16 version;
  30. /* The exit code of a task. */
  31. __u32 ac_exitcode; /* Exit status */
  32. /* The accounting flags of a task as defined in <linux/acct.h>
  33. * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
  34. */
  35. __u8 ac_flag; /* Record flags */
  36. /* The value of task_nice() of a task. */
  37. __u8 ac_nice; /* task_nice */
  38. /* The name of the command that started this task. */
  39. char ac_comm[TS_COMM_LEN]; /* Command name */
  40. /* The scheduling discipline as set in task->policy field. */
  41. __u8 ac_sched; /* Scheduling discipline */
  42. __u8 ac_pad[3];
  43. __u32 ac_uid; /* User ID */
  44. __u32 ac_gid; /* Group ID */
  45. __u32 ac_pid; /* Process ID */
  46. __u32 ac_ppid; /* Parent process ID */
  47. /* The time when a task begins, in [secs] since 1970. */
  48. __u32 ac_btime; /* Begin time [sec since 1970] */
  49. /* The elapsed time of a task, in [usec]. */
  50. __u64 ac_etime; /* Elapsed time [usec] */
  51. /* The user CPU time of a task, in [usec]. */
  52. __u64 ac_utime; /* User CPU time [usec] */
  53. /* The system CPU time of a task, in [usec]. */
  54. __u64 ac_stime; /* System CPU time [usec] */
  55. /* The minor page fault count of a task, as set in task->min_flt. */
  56. __u64 ac_minflt; /* Minor Page Fault Count */
  57. /* The major page fault count of a task, as set in task->maj_flt. */
  58. __u64 ac_majflt; /* Major Page Fault Count */
  59. 2) Delay accounting fields:
  60. /* Delay accounting fields start
  61. *
  62. * All values, until the comment "Delay accounting fields end" are
  63. * available only if delay accounting is enabled, even though the last
  64. * few fields are not delays
  65. *
  66. * xxx_count is the number of delay values recorded
  67. * xxx_delay_total is the corresponding cumulative delay in nanoseconds
  68. *
  69. * xxx_delay_total wraps around to zero on overflow
  70. * xxx_count incremented regardless of overflow
  71. */
  72. /* Delay waiting for cpu, while runnable
  73. * count, delay_total NOT updated atomically
  74. */
  75. __u64 cpu_count;
  76. __u64 cpu_delay_total;
  77. /* Following four fields atomically updated using task->delays->lock */
  78. /* Delay waiting for synchronous block I/O to complete
  79. * does not account for delays in I/O submission
  80. */
  81. __u64 blkio_count;
  82. __u64 blkio_delay_total;
  83. /* Delay waiting for page fault I/O (swap in only) */
  84. __u64 swapin_count;
  85. __u64 swapin_delay_total;
  86. /* cpu "wall-clock" running time
  87. * On some architectures, value will adjust for cpu time stolen
  88. * from the kernel in involuntary waits due to virtualization.
  89. * Value is cumulative, in nanoseconds, without a corresponding count
  90. * and wraps around to zero silently on overflow
  91. */
  92. __u64 cpu_run_real_total;
  93. /* cpu "virtual" running time
  94. * Uses time intervals seen by the kernel i.e. no adjustment
  95. * for kernel's involuntary waits due to virtualization.
  96. * Value is cumulative, in nanoseconds, without a corresponding count
  97. * and wraps around to zero silently on overflow
  98. */
  99. __u64 cpu_run_virtual_total;
  100. /* Delay accounting fields end */
  101. /* version 1 ends here */
  102. 3) Extended accounting fields
  103. /* Extended accounting fields start */
  104. /* Accumulated RSS usage in duration of a task, in MBytes-usecs.
  105. * The current rss usage is added to this counter every time
  106. * a tick is charged to a task's system time. So, at the end we
  107. * will have memory usage multiplied by system time. Thus an
  108. * average usage per system time unit can be calculated.
  109. */
  110. __u64 coremem; /* accumulated RSS usage in MB-usec */
  111. /* Accumulated virtual memory usage in duration of a task.
  112. * Same as acct_rss_mem1 above except that we keep track of VM usage.
  113. */
  114. __u64 virtmem; /* accumulated VM usage in MB-usec */
  115. /* High watermark of RSS usage in duration of a task, in KBytes. */
  116. __u64 hiwater_rss; /* High-watermark of RSS usage */
  117. /* High watermark of VM usage in duration of a task, in KBytes. */
  118. __u64 hiwater_vm; /* High-water virtual memory usage */
  119. /* The following four fields are I/O statistics of a task. */
  120. __u64 read_char; /* bytes read */
  121. __u64 write_char; /* bytes written */
  122. __u64 read_syscalls; /* read syscalls */
  123. __u64 write_syscalls; /* write syscalls */
  124. /* Extended accounting fields end */
  125. }