ps 和 top cpu 占用区别
2012-10-10 17:52
363 查看
ps和topcpu 占用区别:
但试了一会发现个不小的问题,把包含flash的网页关掉后,ps显示它的cpu占用率还是居高不下。奇怪了,难道它还在后台工作吗?我又用top看了下,更奇怪了,top显示flash占用的cpu分明是0。又等了一会,ps显示的还是好几十。
以前好像也发现过这样的问题,但以为是误差等问题也没细想,但今天看这显然和误差什么的没关系。
上网找了找,终于明白了。
看看man
ps里的相关内容:
再看看top的:
就不难理解了。ps是从进程开始就开始算的,是平均的占用率;而top是从上次刷新开始算的,一般几秒钟一刷,可以认为是即时的。而桌面系统我们一般更关注即时的,所以top的cpu占用率才是我需要的。而且top默认cpu的占用率的和并不是100%,而是核数x100%,所以有时会有一个进程占用超过100%的情况。
但试了一会发现个不小的问题,把包含flash的网页关掉后,ps显示它的cpu占用率还是居高不下。奇怪了,难道它还在后台工作吗?我又用top看了下,更奇怪了,top显示flash占用的cpu分明是0。又等了一会,ps显示的还是好几十。
以前好像也发现过这样的问题,但以为是误差等问题也没细想,但今天看这显然和误差什么的没关系。
上网找了找,终于明白了。
看看man
ps里的相关内容:
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%.
再看看top的:
k: %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 'Irix mode' is Off, top will operate in 'Solaris mode' where a task's cpu usage will be divided by the total number of CPUs. You toggle 'Irix/Solaris' modes with the 'I' interactive command.
就不难理解了。ps是从进程开始就开始算的,是平均的占用率;而top是从上次刷新开始算的,一般几秒钟一刷,可以认为是即时的。而桌面系统我们一般更关注即时的,所以top的cpu占用率才是我需要的。而且top默认cpu的占用率的和并不是100%,而是核数x100%,所以有时会有一个进程占用超过100%的情况。
相关文章推荐
- ps 和 top cpu 占用区别
- top和ps命令cpu占用的区别
- Linux下提供top、ps命令查看当前cpu、mem使用情况
- Linux TOP命令 按内存占用排序和按CPU占用排序
- top与ps区别
- linux中top与ps区别
- 查看进程占用内存cpu信息,Linux命令—TOP
- Linux TOP命令 按内存占用排序和按CPU占用排序
- PS,TOP,PIDSTAT -R 等看的单个进程内存占用不准-----理解Linux上的内存使用
- 生产环境下CPU过高故障排查--top、ps、grep、printf、jstack等命令排查
- solaris系统用ps命令查看进程占用的CPU、内存等情况
- centos linux系统日常管理复习 CPU物理数逻辑核数,iftop ,iotop ,sar ,ps,netstat ,一网卡多IP,mii-tool 连接,ethtool速率,一个网卡配置多个IP,mii-tool 连接,ethtool速率 ,crontab备份, 第十八节课
- linux下采用ps、jstack命令排查命中java应用中占用CPU高的代码
- Linux TOP命令 按内存占用排序和按CPU占用排序
- Linux TOP命令(按内存占用排序和按CPU占用排序)
- 查看进程占用内存cpu信息,Linux命令—TOP
- linux下top命令查看cpu占用情况
- linux中top与ps区别
- Linux TOP命令 按内存占用排序和按CPU占用排序
- Linux中ps与top命令的细微区别