翻译文件Documentation/filesystems/proc.txt的1.8节,关于/proc/stat文件内容的描述:

1.8 位于/proc/stat文件中的内核杂项统计
-------------------------------------------------

内核在文件/proc/stat中保存了有关自身活动的各种信息。所有的统计数字都是自系统启动后累加起来的。使用cat命令简单的查看下文件:

  > cat /proc/stat
  cpu  2255 34 2290 22625563 6290 127 456 0 0 0
  cpu0 1132 34 1441 11311718 3675 127 438 0 0 0
  cpu1 1123 0 849 11313845 2614 0 18 0 0 0
  intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
  ctxt 1990473
  btime 1062191376
  processes 2915
  procs_running 1
  procs_blocked 0
  softirq 183433 0 21755 12 39 1137 231 21459 2263

以cpu开头的第一行统计数字为之后行cpu统计值的总和。这些数字值标识cpu处理器不同类型的事务耗费的时间总和。单位为USER_HZ(典型值为100)。以下按照从左到右的顺序说明每一列数字的含义。

- user: 用户态正常进程执行时间

- nice: 用户态nice值为负的进程执行时间

- system: 进程在内核态的执行时间

- idle: 空闲时间

- iowait: 简单来说,iowait代表着等待I/O操作完成的时间。但是还有几个问题:
  1. 处理器不会一直等待I/O操作完成,iowait是任务等待I/O完成的时间。当有任务的I/O操作未完成时处理器进入空闲状态,其它的任务将调度到此处理器执行。
  2. 在多核处理器上,等待I/O操作完成的任务不在任何CPU上运行,所以每个CPU的iowait时间很难统计。
  3. PROC文件stat中的iowait值在一定情况下还会减少。
  所以,文件stat中的iowait值并不准确。

- irq: 硬件中断的执行时间

- softirq: 软中断的执行时间

- steal: 非自主等待时间

- guest: 运行正常客户机的时间

- guest_nice: 运行niced客户机的时间

"intr"行显示了自启动以来服务的每种系统中断的总和。第一列是所有中断的总数包括没有中断号的体系结构特殊中断;以后的每一列显示一个特定具有中断号的中断总数。无中断号的中断未单独显示,包括在了第一列的总数中。

"ctxt"行显示在所有CPU直接上下文切换的总数。

"btime"含显示系统启动的时间,其值为自1970年1月1日00:00.00后的秒数。

"processes"行显示创建的进程和线程的总数,包括但不限于由fork和clone系统调用创建的。

"procs_running"行显示在运行或者就绪状态的线程总数(例如,可运行线程的总数)。

"procs_blocked"行显示处于阻塞状态等待I/O完成的进程总数。

"softirq"行显示自系统启动以来,服务的所有软中断的总数。第一列为所有软中断的总数,之后的每一列为某一特定软中断的总数。

英文原文:

1.8 Miscellaneous kernel statistics in /proc/stat

-------------------------------------------------

Various pieces   of  information about  kernel activity  are  available in the /proc/stat file.  All  of  the numbers reported  in  this file are  aggregates since the system first booted.  For a quick look, simply cat the file:

  > cat /proc/stat
  cpu  2255 34 2290 22625563 6290 127 456 0 0 0
  cpu0 1132 34 1441 11311718 3675 127 438 0 0 0
  cpu1 1123 0 849 11313845 2614 0 18 0 0 0
  intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
  ctxt 1990473
  btime 1062191376
  processes 2915
  procs_running 1
  procs_blocked 0
  softirq 183433 0 21755 12 39 1137 231 21459 2263

The very first  "cpu" line aggregates the  numbers in all  of the other "cpuN" lines.  These numbers identify the amount of time the CPU has spent performing different kinds of work.  Time units are in USER_HZ (typically hundredths of a second).  The meanings of the columns are as follows, from left to right:

- user: normal processes executing in user mode
- nice: niced processes executing in user mode
- system: processes executing in kernel mode
- idle: twiddling thumbs
- iowait: In a word, iowait stands for waiting for I/O to complete. But there are several problems:
  1. Cpu will not wait for I/O to complete, iowait is the time that a task is waiting for I/O to complete. When cpu goes into idle state for outstanding task io, another task will be scheduled on this CPU.
  2. In a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to calculate.
  3. The value of iowait field in /proc/stat will decrease in certain conditions.
  So, the iowait is not reliable by reading from /proc/stat.

- irq: servicing interrupts
- softirq: servicing softirqs
- steal: involuntary wait
- guest: running a normal guest
- guest_nice: running a niced guest

The "intr" line gives counts of interrupts  serviced since boot time, for each of the  possible system interrupts.   The first  column  is the  total of  all interrupts serviced  including  unnumbered  architecture specific  interrupts; each  subsequent column is the  total for that particular numbered interrupt. Unnumbered interrupts are not shown, only summed into the total.

The "ctxt" line gives the total number of context switches across all CPUs.

The "btime" line gives  the time at which the  system booted, in seconds since the Unix epoch.

The "processes" line gives the number  of processes and threads created, which includes (but  is not limited  to) those  created by  calls to the  fork() and clone() system calls.

The "procs_running" line gives the total number of threads that are running or ready to run (i.e., the total number of runnable threads).

The   "procs_blocked" line gives  the  number of  processes currently blocked, waiting for I/O to complete.

The "softirq" line gives counts of softirqs serviced since boot time, for each of the possible system softirqs. The first column is the total of all softirqs serviced; each subsequent column is the total for that particular softirq.

PROC文件中stat统计信息相关推荐

  1. Android开发过程中在sh,py,mk文件中添加log信息的方法

    Android开发过程中在sh,py,mk文件中添加log信息的方法 在sh文件中: echo "this is a log info" + $info 在py文件中: print ...

  2. 血淋淋的事实告诉你:你为什么不应该在JS文件中保存敏感信息

    在JavaScript文件中存储敏感数据,不仅是一种错误的实践方式,而且还是一种非常危险的行为,长期以来大家都知道这一点. 而原因也非常简单,我们可以假设你为你的用户动态生成了一个包含API密钥的Ja ...

  3. 利用Python提取PDF文件中的文本信息

    如何利用Python提取PDF文件中的文本信息 日常工作中我们经常会用到pdf格式的文件,大多数情况下是浏览或者编辑pdf信息,但有时候需要提取pdf中的文本,如果是单个文件的话还可以通过复制粘贴来直 ...

  4. 读取DWG文件中的文本信息(CAD2004)

    还是那句话,工作需要,不然是不会研究这个的.也许有的人会遇到跟我一样的问题,有兴趣看看,可以节约点时间.运行时要引用CAD2004的COM,这种读取文本的方式并不好,需要机器上装有AUTOCAD200 ...

  5. 利用EXIF库读取jpg文件中的经纬度信息

    利用EXIF库读取jpg文件中的经纬度信息 EXIF库API参考:http://code.ciaoca.com/javascript/exif-js/ <!DOCTYPE html> &l ...

  6. 提取EPSON机器人示教点位pts文件中的点位信息

    由于操作需要,写了一个程序将爱普生机器人(EPSON)的pts文件中的点位信息进行提取,如下: package mainimport ("bufio""encoding/ ...

  7. 从属性资源文件中读取连接数据库信息

    从属性资源文件中读取连接数据库信息 jdbc.properties 属性配置文件 driver=com.mysql.jdbc.Driver url=jdbc:mysql://127.0.0.1:330 ...

  8. JS文件中的敏感信息+swagger接口测试

    01 JS中的敏感信息 实战中会经常遇到很多js文件,在js文件中很可能会遇到一些敏感信息和路径之类的,遇到路径可以尝试拼接,有可能会遇到未授权的情况等等,也有很多站点是webpack打包,可以F12 ...

  9. 【python学习】批量读取Materials Studio的sdf文件,从文件中提取特定信息并按列存储在CSV文件

    批量读取Materials Studio的sdf文件,从文件中提取特定信息并按列存储在CSV文件 Materials Studio在执行dmol3模块中结构优化任务时,任务结束后会产生一系列的输出文件 ...

最新文章

  1. 第三课.使用简单的NN模拟fizzbuzz
  2. 阿德莱德计算机专业排名,阿德莱德大学专业排名第几?2019年榜单揭晓!
  3. 监控h264视频不能正常解码怎么办
  4. 使用Mongo索引需要注意的几个点
  5. QT5_PYQT导入自己的图片
  6. selenium使用TestNG实现DDT
  7. 记个SwitchButton笔记
  8. iOS开发-UITableView常用方法
  9. 全网疯传的PDF干货合集,50个精选BAT等大厂大数据、算法落地经验,白拿不谢!...
  10. (软考信息安全工程师--中级)二、网络攻击原理与常用方法
  11. 基于单片机设计的遥控数字音量控制D类功率放大器设计
  12. 热门文献|陈国生:实证化中医基础理论依据及应用
  13. 电脑用户计算机名文件夹,win7更改计算机用户名_win7更改用户名文件夹
  14. 如何设置Macbook pro的Touch bar
  15. 惊了,Python 民俗社会科学项目,看看能否预测【面向哪里写BUG少】
  16. 年轻一代程序员:社牛、不卷、玩开源
  17. 拇指锁屏APP:时代新起锁屏之秀
  18. 扩散模型爆火,这是首篇综述与Github论文分类汇总
  19. UE4 安卓打包失败“Build-tool 31.0.0 is missing DX”
  20. 虾皮平台运营的妙招—扬帆凌远

热门文章

  1. pthread使用方法
  2. IDEA快捷键200+分类汇总
  3. 淡马锡:48年新加坡「最强国企」,深入布局Web3
  4. 火绒杀毒-史上最好用的杀毒软件
  5. 微信小程序中换行空格(多个空格)
  6. nvidia/cuda docker镜像标签
  7. javascript比较两个时间的大小
  8. xtu寒假做题1月7日题解
  9. 写在年终岁末,回顾2008,展望2009
  10. php循环立方函数,php递归函数_php递归示例 php递归函数代码