免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3936 | 回复: 9
打印 上一主题 下一主题

请教sar和top中的cpu的id有什么区别! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-12-14 13:05 |只看该作者 |倒序浏览
现在系统使用sar查看cpu的状态,其%idle是00.00,而使用top查看其cpu的id确是90%以上,这个两个有什么区别,那个是真实cpu目前的使用状态呢!迷惑!

论坛徽章:
0
2 [报告]
发表于 2006-12-14 13:15 |只看该作者
sar CPU idle doesn't count io wait while top does. If you add %wio and %idle in sar, it should approx. = top's id

论坛徽章:
0
3 [报告]
发表于 2006-12-14 13:32 |只看该作者
楼上说的好像不对吧?

13:27:12          CPU     %user     %nice   %system   %iowait     %idle
13:27:13          all     63.64      0.00     18.18     18.18      0.00
13:27:14          all     65.22      0.00     13.04     21.74      0.00
13:27:15          all      0.00      0.00      0.00    100.00      0.00

sar的%idle应该是100-前面几个值的和

我的系统使用sar查看%idle时钟是0.00,而使用top查看确是
Tasks: 147 total,   1 running, 146 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.5% us,  1.4% sy,  0.0% ni, 95.5% id,  0.7% wa,  0.0% hi,  0.0% si
Mem:   8306500k total,  7182796k used,  1123704k free,   258352k buffers
Swap:  2096472k total,        0k used,  2096472k free,  5242728k cached

其id是95.5%,请问这是怎么回事呢,有什么区别!

论坛徽章:
0
4 [报告]
发表于 2006-12-14 13:42 |只看该作者
你确定是在同一时刻抓取的数据吗?:wink:

论坛徽章:
0
5 [报告]
发表于 2006-12-14 13:51 |只看该作者
The last line of your sar output tells your that your iowait was 100% and your %id was 0. If you add them together (%100) it should approx equal to the top %id, which was 95.5%. Obveriously you didn't catch the data at exactly the same time. But there were in the ballpark

论坛徽章:
0
6 [报告]
发表于 2006-12-14 14:09 |只看该作者
这个sar和top数据是是我看两个窗口同时抓出来的,所以我决的奇怪!

论坛徽章:
0
7 [报告]
发表于 2006-12-14 14:12 |只看该作者
现在我系统用sar查看,idle始终是0.00
[zxin10@IN1 ~]$ sar 1 10
Linux 2.6.9-5.13smp (IN1)       12/14/06

14:11:03          CPU     %user     %nice   %system   %iowait     %idle
14:11:04          all     50.00      0.00     50.00      0.00      0.00
14:11:05          all     50.00      0.00      0.00     50.00      0.00
14:11:06          all      3.92      0.00      0.00     96.08      0.00
14:11:07          all     12.50      0.00     12.50     75.00      0.00
14:11:08          all     33.33      0.00     22.22     44.44      0.00

14:11:08          CPU     %user     %nice   %system   %iowait     %idle
14:11:09          all     41.67      0.00     50.00      8.33      0.00
14:11:10          all      0.00      0.00     10.00     90.00      0.00
14:11:11          all     66.67      0.00     33.33      0.00      0.00
14:11:12          all     36.36      0.00     18.18     45.45      0.00

14:11:12          CPU     %user     %nice   %system   %iowait     %idle
14:11:13          all     40.00      0.00      0.00     60.00      0.00
Average:          all     18.58      0.00     12.39     69.03      0.00

这个是怎么回事呢!
而top显示
top - 14:12:27 up 112 days, 27 min,  1 user,  load average: 0.12, 0.29, 0.27
Tasks: 147 total,   1 running, 146 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3% us,  0.1% sy,  0.0% ni, 97.3% id,  2.3% wa,  0.0% hi,  0.0% si
Mem:   8306500k total,  7184068k used,  1122432k free,   258352k buffers
Swap:  2096472k total,        0k used,  2096472k free,  5243508k cached

id始终在95%以上!

论坛徽章:
0
8 [报告]
发表于 2006-12-14 14:29 |只看该作者
Which Linux are you using? can you show me the result of
cat /sys/module/processor/parameters/max_cstate  
if the file exists?

论坛徽章:
0
9 [报告]
发表于 2006-12-14 14:38 |只看该作者
用的是turbo 10 ,没有这个sys/module/processor/parameters/max_cstate文件!

论坛徽章:
0
10 [报告]
发表于 2006-12-14 15:16 |只看该作者
Well, the sar samples you were collecting were every one second, while the top refresh rate is about 3 sec. I'm not sure whether turbo linux uses 3 sec default refresh rate or not. Assuming it is, try to run sar 3 10 in parallel with top in a separate window to see what happens. Please realize that the shorter the sampling interval, the less accurate the result is because of the fluctuation. You may choose a longer period of sampling interval to compare the result. Also I know that there is a bug in certain version of Linux running on certain hardware. That is why I asked you the previous question.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP