PROC系列之---/proc/pid/stat

/proc/ /stat
包含了所有CPU活跃的信息,该文件中的所有值都是从系统启动开始累计到当前时刻。

[root@localhost ~]# cat /proc/6873/stat
6873 (a.out) R 6723 6873 6723 34819 6873 8388608 77 0 0 0 41958 31 0 0 25 0 3 0 5882654 1409024 56 4294967295 134512640 134513720 3215579040 0 2097798 0 0 0 0 0 0 0 17 0 0 0 [root@localhost ~]#

每个参数意思为:
参数 解释
pid=6873 进程(包括轻量级进程,即线程)号
comm=a.out 应用程序或命令的名字
task_state=R 任务的状态,R:runnign, S:sleeping (TASK_INTERRUPTIBLE), D:disk sleep (TASK_UNINTERRUPTIBLE), T: stopped, T:tracing stop,Z:zombie, X:dead
ppid=6723 父进程ID
pgid=6873 线程组号
sid=6723 c该任务所在的会话组ID
tty_nr=34819(pts/3) 该任务的tty终端的设备号,INT(34817/256)=主设备号,(34817-主设备号)=次设备号
tty_pgrp=6873 终端的进程组号,当前运行在该任务所在终端的前台任务(包括shell 应用程序)的PID。
task->flags=8388608 进程标志位,查看该任务的特性
min_flt=77 该任务不需要从硬盘拷数据而发生的缺页(次缺页)的次数
cmin_flt=0 累计的该任务的所有的waited-for进程曾经发生的次缺页的次数目
maj_flt=0 该任务需要从硬盘拷数据而发生的缺页(主缺页)的次数
cmaj_flt=0 累计的该任务的所有的waited-for进程曾经发生的主缺页的次数目
utime=1587 该任务在用户态运行的时间,单位为jiffies
stime=1 该任务在核心态运行的时间,单位为jiffies
cutime=0 累计的该任务的所有的waited-for进程曾经在用户态运行的时间,单位为jiffies
cstime=0 累计的该任务的所有的waited-for进程曾经在核心态运行的时间,单位为jiffies
priority=25 任务的动态优先级
nice=0 任务的静态优先级
num_threads=3 该任务所在的线程组里线程的个数
it_real_value=0 由于计时间隔导致的下一个 SIGALRM 发送进程的时延,以 jiffy 为单位.
start_time=5882654 该任务启动的时间,单位为jiffies
vsize=1409024(page) 该任务的虚拟地址空间大小
rss=56(page) 该任务当前驻留物理地址空间的大小
Number of pages the process has in real memory,minu 3 for administrative purpose.
这些页可能用于代码,数据和栈。
rlim=4294967295(bytes) 该任务能驻留物理地址空间的最大值
start_code=134512640 该任务在虚拟地址空间的代码段的起始地址
end_code=134513720 该任务在虚拟地址空间的代码段的结束地址
start_stack=3215579040 该任务在虚拟地址空间的栈的结束地址
kstkesp=0 esp(32 位堆栈指针) 的当前值, 与在进程的内核堆栈页得到的一致.
kstkeip=2097798 指向将要执行的指令的指针, EIP(32 位指令指针)的当前值.
pendingsig=0 待处理信号的位图,记录发送给进程的普通信号
block_sig=0 阻塞信号的位图
sigign=0 忽略的信号的位图
sigcatch=082985 被俘获的信号的位图
wchan=0 如果该进程是睡眠状态,该值给出调度的调用点
nswap 被swapped的页数,当前没用
cnswap 所有子进程被swapped的页数的和,当前没用
exit_signal=17 该进程结束时,向父进程所发送的信号
task_cpu(task)=0 运行在哪个CPU上
task_rt_priority=0 实时进程的相对优先级别
task_policy=0 进程的调度策略,0=非实时进程,1=FIFO实时进程;2=RR实时进程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The /proc/PID/stat file contains various statistics about the process with the specified PID. The file is a single line of text, with each field separated by a space. The fields in the file are as follows: 1. pid - process ID 2. comm - name of the command that started the process 3. state - current state of the process (e.g. running, sleeping, etc.) 4. ppid - parent process ID 5. pgrp - process group ID 6. session - session ID 7. tty_nr - controlling terminal of the process 8. tpgid - ID of the foreground process group of the controlling terminal 9. flags - process flags (e.g. whether it is being traced, etc.) 10. minflt - number of minor faults (i.e. page faults that could be resolved without disk IO) 11. cminflt - number of minor faults of child processes 12. majflt - number of major faults (i.e. page faults that required disk IO) 13. cmajflt - number of major faults of child processes 14. utime - amount of time the process has spent in user mode 15. stime - amount of time the process has spent in kernel mode 16. cutime - amount of time waited-for children have been in user mode 17. cstime - amount of time waited-for children have been in kernel mode 18. priority - priority of the process 19. nice - nice value of the process 20. num_threads - number of threads in the process 21. starttime - time the process started, in jiffies (1/100th of a second) 22. vsize - virtual memory size of the process 23. rss - resident set size of the process (i.e. amount of physical memory it is using) 24. rsslim - current limit on the resident set size 25. startcode - address of the start of the code segment 26. endcode - address of the end of the code segment 27. startstack - address of the start of the stack 28. kstkesp - current value of the stack pointer 29. kstkeip - current value of the instruction pointer 30. signal - bitmap of pending signals for the process 31. blocked - bitmap of blocked signals for the process 32. sigignore - bitmap of ignored signals for the process 33. sigcatch - bitmap of caught signals for the process 34. wchan - address of the kernel function the process is currently waiting in 35. nswap - number of pages swapped to disk 36. cnswap - number of pages swapped to disk of child processes 37. exit_signal - signal to be sent to the parent process when the process exits 38. processor - CPU the process last ran on 39. rt_priority - real-time priority of the process 40. policy - scheduling policy of the process Note: Some fields may be displayed as 0 if they are not applicable to the process or if they are not available. Also, the values for utime, stime, cutime, and cstime are given in clock ticks, which can be converted to seconds by dividing by the value of the system variable HZ (which is typically 100 on most systems).

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值