查看多核cpu信息

1. 在Linux下,如何确认是多核或多CPU:

#cat /proc/cpuinfo

如果有多个类似以下的项目,则为多核或多CPU:

processor       : 0

......

processor       : 1

2. Linux下,如何看每个CPU的使用率:

#top -d 1

之后按下1 . 则显示多个CPU

Cpu0  :  1.0%us,  3.0%sy,  0.0%ni, 96.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

3. 如何察看某个进程在哪个CPU上运行:

#top -d 1

之后按下f .进入top Current Fields设置页面:

选中:j : P          = Last used cpu (SMP)

则多了一项:P 显示此进程使用哪个CPU。

Sam经过试验发现:同一个进程,在不同时刻,会使用不同CPU Core.这应该是Linux Kernel SMP处理的。

猜你喜欢

转载自eric-gcm.iteye.com/blog/1155633