Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1455177
  • 博文数量: 596
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 173
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-06 15:50
个人简介

在线笔记

文章分类

全部博文(596)

文章存档

2016年(1)

2015年(104)

2014年(228)

2013年(226)

2012年(26)

2011年(11)

分类: LINUX

2013-04-16 10:00:56

物理CPU,多核,超线程
判断依据:

1.具有相同core id的cpu是同一个core的超线程。

2.具有相同physical id的cpu是同一颗cpu封装的线程或者cores。

英文版:

1.Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core.

2.Any cpu with the same physical id are threads or cores in the same physical socket.

1. 物理CPU,多核,超线程
1)物理CPU个数

$ cat /proc/cpuinfo | grep "physical id" | uniq
physical id     : 0
=>CPU个数:1个

2)CPU核数
$ cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores       : 8
=》CPU核数:8个核

3)是否是超线程
$ cat /proc/cpuinfo | grep "core id"
core id         : 0
core id         : 1
core id         : 2
core id         : 3
core id         : 4
core id         : 5
core id         : 6
core id         : 7
=》core id都不一样,所以没有超线程



2。查看每个CPU的使用率
$top -d 1(数字1)
再按数字1,显示如下
Tasks: 194 total,   1 running, 193 sleeping,   0 stopped,   0 zombie
Cpu0  :  0.0%us,  0.0%sy,  0.0%ni,100.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
Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu4  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu5  :  0.0%us,  1.0%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu6  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu7  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3095260k total,  1871716k used,  1223544k free,   622332k buffers
Swap:  4191228k total,        0k used,  4191228k free,   904036k cached


3。查看进程是哪个CPU上运行
$top -d 1(数字1)
f,进入"top Current Fields"
j,选中  j: P          = Last used cpu (SMP)
回车

多了一列P,COMMAND前面
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  P COMMAND                                      
 9978 public    20   0  2632 1196  876 R    1  0.0   0:02.64 5   top                                          

4。查看当前内核是否支持SMP
$uname -a
Linux  2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux
有SMP
阅读(1396) | 评论(0) | 转发(0) |
0

上一篇:configure小记

下一篇:OPENMP之hello

给主人留下些什么吧!~~