/proc/pid/stat: Difference between revisions
No edit summary |
|||
(35 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
* [[Linux proc#Overview|Linux proc]] | * [[Linux proc#Overview|Linux proc]] | ||
* [[Linux Per-Process CPU Runtime Statistics#Overview|Per-Process CPU Runtime Statistics]] | |||
=Overview= | =Overview= | ||
Line 17: | Line 18: | ||
=Content= | =Content= | ||
[[#Field_1_-_pid|pid]] ([[#Field_2_-_Executable_File_Name|exec-file-name]]) [[#Field_3_-_state|state]] | 1:[[#Field_1_-_pid|pid]] 2:([[#Field_2_-_Executable_File_Name|exec-file-name]]) 3:[[#Field_3_-_state|state]] 4:[[#Field_4_-_ppid|ppid]] 5:[[#Field_5_-_pgrp|pgrp]] 6:[[#Field_6_-_session|session]] 7 8 9 10 11 12 13 14:[[#Field_14_-_utime|utime]] 15:[[#Field_15_-_stime|stime]] 16:[[#Field_16_-_cutime|cutime]] 17:[[#Field_17_-_cstime|cstime]] 18 19 20 21 22:[[#Field_22_-_starttime|starttime]] 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43:[[#Field_43_-_guest_time|guest_time]] 44 45 46 47 48 49 50 51 52 | ||
==Field 1 - pid== | ==Field 1 - pid== | ||
Line 48: | Line 49: | ||
The pid of the parent process, as integer. | The pid of the parent process, as integer. | ||
==Field | ==Field 5 - pgrp== | ||
The process group ID, as integer. | |||
==Field | ==Field 6 - session== | ||
The session ID of the process, as integer. | |||
==Field | ==Field 7 - tty_nr== | ||
==Field 8 - tpgid== | |||
==Field 9 - flags== | |||
==Field 10 - minflt== | |||
==Field 11 - cminflt== | |||
==Field 12 - majflt== | |||
==Field 13 - cmajflt== | |||
==Field 14 - utime== | |||
Amount of time that this process has been scheduled in user mode, measured in [[Linux_General_Concepts#USER_HZ|clock ticks]]. Expressed as an unsigned long. This includes [[#Field_43_-_guest_time|guest time]], as described below, so that applications that are not aware of the guest time field do not lose that time from their calculations. | |||
==Field 15 - stime== | |||
Amount of time that this process has been scheduled in kernel mode, measured in [[Linux_General_Concepts#USER_HZ|clock ticks]]. Expressed as an unsigned long. | |||
starttime - | ==Field 16 - cutime== | ||
Waited-for children's CPU time spent in user code expressed in [[Linux_General_Concepts#USER_HZ|clock ticks]]. This includes guest time, which is time spent running a virtual CPU. | |||
==Field 17 - cstime== | |||
Amount of time that this process's waited-for children have been scheduled in kernel mode, measured in [[Linux_General_Concepts#USER_HZ|clock ticks]]. | |||
==Field 18 - priority== | |||
==Field 19 - nice== | |||
==Field 20 - num_threads== | |||
==Field 21 - itrealvalue== | |||
==Field 22 - starttime== | |||
The timestamp of the process start, relative to the system boot. In kernels before 2.6, this value was expressed in jiffies. Since 2.6, the value is expressed in [[Linux_General_Concepts#USER_HZ|clock ticks]]. | |||
To calculate the amount of time the process was up an running, use the following formula: | |||
process-running-time(seconds) = [[/proc/uptime#System_Uptime|system-uptime]](seconds) - (starttime / [[Linux_General_Concepts#USER_HZ|USER_HZ]]) | |||
==Field 23 - vsize== | |||
==Field 24 - rss== | |||
==Field 25 - rsslim== | |||
==Field 26 - startcode== | |||
==Field 27 - endcode== | |||
==Field 28 - startstack== | |||
==Field 29 - kstkesp== | |||
==Field 30 - kstkeip== | |||
==Field 31 - signal== | |||
==Field 32 - blocked== | |||
==Field 33 - sigignore== | |||
==Field 34 - sigcatch== | |||
==Field 35 - wchan== | |||
==Field 36 - nswap== | |||
==Field 37 - cnswap== | |||
==Field 38 - exit_signal== | |||
==Field 39 - processor== | |||
==Field 40 - rt_priority== | |||
==Field 41 - policy== | |||
==Field 42 - delayacct_blkio_ticks== | |||
==Field 43 - guest_time== | |||
Guest time of the process, which is time spent running a virtual CPU for a guest operating system, measured in clock ticks. Expressed as an unsigned long. | |||
==Field 44 - cguest_time== | |||
==Field 45 - start_data== | |||
==Field 46 - end_data== | |||
==Field 47 - start_brk== | |||
==Field 48 - arg_start== | |||
==Field 49 - arg_end== | |||
==Field 50 - env_start== | |||
==Field 51 - env_end== | |||
==Field 52 - exit_code== |
Latest revision as of 21:21, 2 May 2018
External
Internal
Overview
/proc/<pid>/stat contains status information about a process. This information is used by ps.
Example
972 (docker-containe) S 901 972 972 0 -1 1077944576 2657 0 2 0 561 205 0 0 20 0 11 0 1820 441688064 2327 18446744073709551615 4194304 11049596 140727040242048 140727040241432 4602915 0 2079995941 0 2143420159 18446744073709551615 0 0 17 1 0 0 0 0 0 13147640 13322176 25554944 140727040249523 140727040249749 140727040249749 140727040249821 0
Content
1:pid 2:(exec-file-name) 3:state 4:ppid 5:pgrp 6:session 7 8 9 10 11 12 13 14:utime 15:stime 16:cutime 17:cstime 18 19 20 21 22:starttime 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43:guest_time 44 45 46 47 48 49 50 51 52
Field 1 - pid
The process ID as integer.
Field 2 - Executable File Name
The filename of the executable, in parentheses. This is visible whether or not the executable is swapped out.
Field 3 - state
The process state, as character:
- R - running
- S - sleeping in an interruptible wait
- D - waiting in uninterruptible disk sleep
- Z - zombie
- T - stopped on a signal or (before 2.6.33) trace stopped
- t - tracing stop (2.6.33 onward)
- W - paging (before 2.6.0)
- X - dead (from 2.6.0 onward)
- x - dead (2.6.33 to 3.13 only)
- K - wakekill (2.6.33-3.13)
- W - waking (2.6.33-3.13)
- P - parked (3.9-3.13)
Field 4 - ppid
The pid of the parent process, as integer.
Field 5 - pgrp
The process group ID, as integer.
Field 6 - session
The session ID of the process, as integer.
Field 7 - tty_nr
Field 8 - tpgid
Field 9 - flags
Field 10 - minflt
Field 11 - cminflt
Field 12 - majflt
Field 13 - cmajflt
Field 14 - utime
Amount of time that this process has been scheduled in user mode, measured in clock ticks. Expressed as an unsigned long. This includes guest time, as described below, so that applications that are not aware of the guest time field do not lose that time from their calculations.
Field 15 - stime
Amount of time that this process has been scheduled in kernel mode, measured in clock ticks. Expressed as an unsigned long.
Field 16 - cutime
Waited-for children's CPU time spent in user code expressed in clock ticks. This includes guest time, which is time spent running a virtual CPU.
Field 17 - cstime
Amount of time that this process's waited-for children have been scheduled in kernel mode, measured in clock ticks.
Field 18 - priority
Field 19 - nice
Field 20 - num_threads
Field 21 - itrealvalue
Field 22 - starttime
The timestamp of the process start, relative to the system boot. In kernels before 2.6, this value was expressed in jiffies. Since 2.6, the value is expressed in clock ticks.
To calculate the amount of time the process was up an running, use the following formula:
process-running-time(seconds) = system-uptime(seconds) - (starttime / USER_HZ)
Field 23 - vsize
Field 24 - rss
Field 25 - rsslim
Field 26 - startcode
Field 27 - endcode
Field 28 - startstack
Field 29 - kstkesp
Field 30 - kstkeip
Field 31 - signal
Field 32 - blocked
Field 33 - sigignore
Field 34 - sigcatch
Field 35 - wchan
Field 36 - nswap
Field 37 - cnswap
Field 38 - exit_signal
Field 39 - processor
Field 40 - rt_priority
Field 41 - policy
Field 42 - delayacct_blkio_ticks
Field 43 - guest_time
Guest time of the process, which is time spent running a virtual CPU for a guest operating system, measured in clock ticks. Expressed as an unsigned long.