日期:2014-05-16  浏览次数:20554 次

top CPU使用率问题
top - 20:31:32 up 33 days, 2:47, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 150 total, 2 running, 148 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.7%us, 0.2%sy, 0.0%ni, 98.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8185464k total, 1362088k used, 6823376k free, 173028k buffers
Swap: 5816312k total, 0k used, 5816312k free, 873748k cached

  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
 7683 root 20 0 126m 4332 2772 S 11 0.1 0:22.35 mmm_a
 7716 root 20 0 19132 1344 980 R 0 0.0 0:00.13 top
  1 root 20 0 19296 1640 1196 S 0 0.0 0:01.52 init
  2 root 15 -5 0 0 0 S 0 0.0 0:00.00 kthreadd
  3 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/0
  4 root 15 -5 0 0 0 S 0 0.0 0:00.02 ksoftirqd/0
  5 root RT -5 0 0 0 S 0 0.0 0:00.00 watchdog/0
  6 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/1
  7 root 15 -5 0 0 0 S 0 0.0 0:00.49 ksoftirqd/1
  8 root RT -5 0 0 0 S 0 0.0 0:00.00 watchdog/1
  9 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/2
  10 root 15 -5 0 0 0 S 0 0.0 0:00.05 ksoftirqd/2
  11 root RT -5 0 0 0 S 0 0.0 0:00.00 watchdog/2
  12 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/3
  13 root 15 -5 0 0 0 S 0 0.0 0:00.87 ksoftirqd/3
  14 root RT -5 0 0 0 S 0 0.0 0:00.00 watchdog/3
  15 root RT -5 0 0 0 S 0 0.0 0:00.05 migration/4


为什么最上面显示CPU使用Cpu(s): 1.7%us,而7683一个进程就显示使用11%呢?

------解决方案--------------------
这两个信息是不一样的,
第三行的1.7%us表示的是用户空间占用CPU百分比
%CPU 11%表示进程7683最近一次刷新以来所占用的CPU时间和总时间的百分比。
------解决方案--------------------
如果不会看top 就用vmstat命令查看 最后一个域就是cpu信息的
也可以去google上找个top的详解
比如http://blog.chinaunix.net/u1/51714/showart_507233.html