运行top -b -n 1时,该命令始终返回相同的cpu值.
连续5次考虑以下测试运行:
[user@server ~]$top -b -n 5 -d.2 | grep "cpu(s)"cpu(s): 18.5%us,10.0%sy,0.0%ni,67.0%ID,4.2%wa,0.0%hi,0.2%si,0.1%stcpu(s): 39.8%us,27.7%sy,31.3%ID,0.0%wa,1.2%si,0.0%stcpu(s): 39.0%us,35.4%sy,23.2%ID,1.2%stcpu(s): 41.2%us,34.1%sy,15.3%ID,1.2%wa,2.4%si,5.9%stcpu(s): 59.0%us,30.1%sy,4.8%ID,3.6%si,2.4%st[user@server ~]$top -b -n 5 -d.2 | grep "cpu(s)"cpu(s): 18.5%us,0.1%stcpu(s): 18.9%us,17.8%sy,63.3%ID,0.0%si,0.0%stcpu(s): 18.8%us,21.2%sy,55.3%ID,2.4%wa,1.2%stcpu(s): 29.4%us,24.7%sy,45.9%ID,0.0%stcpu(s): 60.5%us,24.4%sy,11.6%ID,1.2%st[user@server ~]$top -b -n 5 -d.2 | grep "cpu(s)"cpu(s): 18.5%us,0.1%stcpu(s): 43.4%us,38.6%sy,15.7%ID,1.2%stcpu(s): 55.3%us,40.0%sy,4.7%ID,0.0%stcpu(s): 39.5%us,48.8%sy,5.8%ID,3.5%stcpu(s): 40.7%us,55.6%sy,2.5%ID,0.1%stcpu(s): 27.1%us,10.6%sy,61.2%ID,0.0%stcpu(s): 25.3%us,5.7%sy,67.8%ID,1.1%stcpu(s): 15.5%us,16.7%sy,64.3%ID,3.6%stcpu(s): 57.3%us,11.2%sy,30.3%ID,1.1%st[user@server ~]$top -b -n 5 -d.2 | grep "cpu(s)"cpu(s): 18.5%us,0.1%stcpu(s): 44.0%us,6.0%sy,42.9%ID,3.6%stcpu(s): 45.8%us,9.6%sy,44.6%ID,0.0%stcpu(s): 34.5%us,8.3%sy,57.1%ID,0.0%stcpu(s): 38.6%us,14.5%sy,45.8%ID,1.2%st
知道这里有什么问题吗?最佳答案cpu利用率数据计算为一段时间内的平均值.对于第一次迭代,该时间间隔是“从系统启动到现在”;对于后续迭代,时间间隔是“从最后一次迭代到现在”. 总结
以上是内存溢出为你收集整理的linux – top命令第一次迭代总是返回相同的结果全部内容,希望文章能够帮你解决linux – top命令第一次迭代总是返回相同的结果所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)