背景

  在linux系统中提供了2个查询系统负荷值的命令,一个是 ps -o THREAD 一个是 top ,这两个命令都能够查询当前进程的CPU使用率情况,但是所代表的含义确实不一样的,ps -o THREAD 偏向与整个进程周期所占的CPU使用率,而 top 更偏向于某个固定时间窗口的CPU使用率也就是说更倾向于查询实时CPU使用率。

具体

NOTES
This ps works by reading the virtual files in /proc. This ps does not need to be setuid kmem or have any privileges to run. Do not give this ps any special permissions. This ps needs access to namelist data for proper WCHAN display. For kernels prior to 2.6, the System.map file must be installed. CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process. This is not ideal, and it does not conform to the
standards that ps otherwise conforms to. CPU usage is unlikely to add up to exactly 100%.

  从第三行 CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process 可知 CPU使用率表示为进程整个生命周期中 与 运行在CPU上所花费的时间 百分比

1. %CPU  --  CPU Usage
The task's share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time. In a true SMP environment, if a process is multi-threaded and top is not operating in Threads mode, amounts greater than 100% may be reported. You toggle Threads mode
with the `H' interactive command.

  根据 CPU Usage The task's share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time.知道CPU使用率是在一个单位时间窗口下该进程占用CPU时间与该单位时间的百分比值。

总结

  1. ps -o THREAD 命令更偏向于整个进程生命中占用CPU时间的比率
  2. top 命令更偏向于某个时间点占用CPU时间的比率

linux - top与ps间的区别的更多相关文章

  1. centos Linux系统日常管理1 cpuinfo cpu核数 命令 w, vmstat, uptime ,top ,kill ,ps ,free,netstat ,sar, ulimit ,lsof ,pidof 第十四节课

    centos Linux系统日常管理1  cpuinfo cpu核数   命令 w, vmstat, uptime ,top ,kill ,ps ,free,netstat ,sar, ulimit ...

  2. top、ps -ef、ps aux的区别及内容详解

    1.top和ps的区别 ps是静态查看进程--------top是动态(持续监控)进程 ps只是查看进程-----------top还可以监视系统性能,如平均负载,cpu和内存的消耗 2.ps -ef ...

  3. 016 Linux 卧槽,看懂进程信息也不难嘛?top、ps

    目录 1 扒开看看 top 命令参数详情 第一行,[top - ]任务队列信息 第二行,[Tasks] 任务(进程) 第三行,[Cpu(s)]状态信息 第四行,[Mem]内存状态 第五行,[Swap] ...

  4. Linux下 ps -ef 和 ps aux 的区别及格式详解

    原文:https://www.cnblogs.com/5201351/p/4206461.html Linux下ps -ef和ps aux的区别及格式详解 Linux下显示系统进程的命令ps,最常用的 ...

  5. linux top ps 命令

    http://javawind.net/p131 VIRT:virtual memory usage 虚拟内存1.进程“需要的”虚拟内存大小,包括进程使用的库.代码.数据等2.假如进程申请100m的内 ...

  6. Linux进程状态——top,ps中看到进程状态D,S,Z的含义

    在top和ps命令中有一列显示进程状态,分别有如下值: 值 含义 S 进程处于interruptable sleep状态 D 进程处于Uninterruptable sleep状态 R 进程处于运行状 ...

  7. Linux命令之ps

    ps [选项] 报告当前进程状态.ps显示有关选择的活动进程的信息.如果要重复更新选择和显示的信息,请使用top.ps命令可以搭配kill随时中断.删除不必要的程序.ps命令是最基本同时也是非常强大的 ...

  8. Linux常用指令---ps(查看进程)

    Linux中的ps命令是Process Status的缩写.ps命令用来列出系统中当前运行的那些进程.ps命令列出的是当前那些进程的快照,就是执行ps命令的那个时刻的那些进程,如果想要动态的显示进程信 ...

  9. 每天一个linux命令(53)--ps命令

    要毁掉一天,从早上开始. Linux中的ps命令是 process status 的缩写.ps 命令用来列出系统中当前运行的那些进程.ps 命令列出的是当前那些进程的快照,就是执行ps 命令的那个时刻 ...

随机推荐

  1. OpenCV各种绘制调用:线,矩形,圆,椭圆,文字

    OpenCV提供了各种绘制接口,可以往图片里画各种东西,这种功能可以为以后在图像上标记一些信息方便调试 // drawcall.cpp: 定义控制台应用程序的入口点. // #include &quo ...

  2. hadoop_2.6.5集群安装

    安装hadoop2.6.5集群: 1.规划设计: JacK6:NameNode,jobtracker JacK7:secondnode,datenode,tasktracker JacK8:datan ...

  3. 2016 CCPC-Final-Wash(优先队列+贪心)

                  Wash Mr.Panda is about to engage in his favourite activity doing laundry! He’s brought ...

  4. kali-2019.4中文乱码问题的解决

    1.安装完kali-2019.4版出现乱码问题 2.更新源,用vi编辑器,在/etc/apt/resources.list中添加清华源 #清华大学 [更新源]deb https://mirrors.t ...

  5. redis5.0 Cluster集群搭建

    安装redis sudo apt update sudo apt install build-essential tcl cd ~ mkdir document/ cd document/ curl ...

  6. python学习Day7--字符串操作

    [主要内容] 1. 补充基础数据类型的相关知识点 1. str. join() 把列表变成字符串 2. 列表不能再循环的时候删除. 因为索引会跟着改变 3. 字典也不能直接循环删除. 把要删除的内容记 ...

  7. what is muxing and demuxing

    They're short for multiplexing and demultiplexing. Multiplexing means combining different types of d ...

  8. 用tensorflow搭建RNN(LSTM)进行MNIST 手写数字辨识

    用tensorflow搭建RNN(LSTM)进行MNIST 手写数字辨识 循环神经网络RNN相比传统的神经网络在处理序列化数据时更有优势,因为RNN能够将加入上(下)文信息进行考虑.一个简单的RNN如 ...

  9. POJ_1182_并查集

    http://poj.org/problem?id=1182 pre构建有关系的号码的树,rel保存当前号码与根的关系,0表示相同,1表示根吃当前,2表示当前吃根. 代码中的更新公式可以先把各种情况枚 ...

  10. 用Python来自动刷智慧树网站的网课

    学校最近让看什么网课,智慧树网站的,太无聊了,写个脚本刷下,这里是用Python+selenium实现的,也可以用js脚本,更简单,但是我这里刚好最近在学python,就顺便练习下,说下有几个点, 1 ...