Chinaunix首页 | 论坛 | 博客
  • 博客访问: 486710
  • 博文数量: 104
  • 博客积分: 3045
  • 博客等级: 少校
  • 技术积分: 1230
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-29 10:18
文章分类

全部博文(104)

文章存档

2011年(72)

2010年(1)

2009年(1)

2008年(30)

分类: LINUX

2011-04-28 18:29:01

对于kernel 的性能分析现在有很多的工具
1 top
   比较早的工具就像windows下的资源管理其一样,可以查看cpu利用率和内存的利用率。
2 uptime
root@yidong proc]# uptime 
 02:31:27 up  4:17,  3 users,  load average: 0.31, 0.26, 0.17
也可以查看cpu的利用率,这个函数主要是在timer里面查看runing 队列中的进程数。
上面这两个工具只是针对调度器进程来推算cpu的利用率,在其他的情况下,比如io操作,进程上下文什么的缺乏全面的系统统计。
3 vmstat iostat dstat 
 dstat
You did not select any stats, using -cdngy by default.
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw 
  3   1  94   1   0   0|  43k   21k|   0     0 |   0     0 | 660   883 
 18   6  71   5   0   0|   0   140k| 250B  200B|   0     0 |1663  2075 
  9   2  88   0   0   0|   0     0 | 152B  116B|   0     0 |1504  2358 
  6   2  92   0   0   0|   0     0 | 264B  116B|   0     0 | 853  1329 
4 在就是intel 公司开发的两个工具 
1) powertop 
  统计cpu 的功耗,在各种状态下的时间
2 )latencytop
aimed at identifying where in the system latency is happening, and what kind of operation/action is causing the latency to happen so that the code can be changed to avoid the worst latency hiccups.

对于系统性能的测定 要看: 
1 thread 是否得到了充分的调度,通过top 等命令看是否会有 进程被抑制
2 除了thread 的调度外,系统有可能在其他方面的损耗,如下文中断,由于这些信息是不被top 记录的,还有就是io的延时操作等,这些是不被记录的。dstat 记录了 usr sys idl wai hiq siq 几个过程的cpu占有率,这样我们可以看到系统的不同层次的time使用情况
3  通过latencytop我们可以看到到底是那些延时在占用我们的CPU。
总之,对于cpu的利用率要从多方面入手,有的时候通过top查看到的cpu利用率很低,但是系统却会反应很缓慢。这个时候就要从usr kernel softirq highirq write_latency 等来判断,到底是那些东西影响我们的CPU使用。

阅读(919) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~