Chinaunix
标题:
top -b -n 1 不刷新
[打印本页]
作者:
peanutshell
时间:
2014-03-25 10:56
标题:
top -b -n 1 不刷新
多次运行取出来的值一样?这个怎么解决
[test@test1]$ top -n 1|grep Cpu
Cpu(s): 4.1% us, 10.3% sy, 0.0% ni, 83.7% id, 1.8% wa, 0.0% hi, 0.1% si
[test@test1]$ top -n 1|grep Cpu
Cpu(s): 4.1% us, 10.3% sy, 0.0% ni, 83.7% id, 1.8% wa, 0.0% hi, 0.1% si
[test@test1]$ top -n 1|grep Cpu
Cpu(s): 4.1% us, 10.3% sy, 0.0% ni, 83.7% id, 1.8% wa, 0.0% hi, 0.1% si
作者:
laliheyi
时间:
2014-03-25 11:25
回复
1#
peanutshell
确实如此,好神奇。还是就这么巧合呢?
作者:
yanu
时间:
2014-03-25 12:51
top -n 1 本来就刷新一次
-n :Number-of-iterations limit as: -n number
Specifies the maximum number of iterations, or frames, top
should produce before ending.
复制代码
作者:
q1208c
时间:
2014-03-25 12:55
top的 取值很可能跟 iosate 是一样的算法, 就是第一次取到的是开机以来的平均值, 对于一台运行时间较长的机器来说, 你在不到1分钟的时间内单次运行top, 结果基本上是一样的. 可以试试 top -n 2 , 就能看出来, 第一次的基本上一样, 第二次(行)的就不同了.
另外, 如果只是想知道 cpu的情况, mpstat 比top更合适.
作者:
yanu
时间:
2014-03-25 20:15
好吧, 我又看错题了...
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2