1、微架构图
前端:预解码、解码、分支预测、L1指令缓存、指令TLB缓存
后端:顺序重排缓存器ROB处理依赖,调度器送到执行引擎
执行引擎:8路超标量,每一路可以进行独立的微操作处理
Port0、1、5、6支持整数、浮点数的加法运算,
Port2、3用于地址生成和加载,
Port4用于存储操作
缓存:L1、L2、数据TLB缓存
2、CPU核的各个参数
2.1 CPU的工作参数
1、时钟周期
时钟频率(英语:clock rate,又译:时钟速度)是指同步电路中时钟的基础频率,它以“每秒时钟周期”(clock cycles per second)来度量,量度单位采用赫兹(Hz)。在计算机领域当中,其一般指的是由处理器中的时钟发生器产生的脉冲信号的频率,该信号用于同步计算机中各部件的工作。时钟频率也被用来作为衡量处理器(例如CPU)运行速度的一个指标,称为处理器的主频。在单个时钟周期内(现代计算机中央处理器内的这个时间一般都短于一纳秒)逻辑零状态与逻辑一状态来回切换
2、基础频率和睿频
如下
基础频率: CPU在不忙时,处理器的速度,大概1秒种 29亿 Hz
睿频:服务器CPU比较忙时,频率可以提高到38亿 Hz
3、查看cpu的工作频率
cat /proc/cpuinfo | grep MHzcpu MHz : 2394.374
2394 MHz = 2.394 GHz = 23.94 亿 Hz
4、cpu的各级缓存
- 使用 getconf 命令查看各级缓存信息
getconf -a | grep CACHE#L1指令缓存 ICACHE表示 指令缓存 32768 字节 32768/1024 = 32 KB (32千字节)
LEVEL1_ICACHE_SIZE 32768
LEVEL1_ICACHE_ASSOC 8
LEVEL1_ICACHE_LINESIZE 64# L1数据缓存 DCACHE表示 数据缓存 32768 字节 32768/1024 = 32 KB (32千字节)
LEVEL1_DCACHE_SIZE 32768
LEVEL1_DCACHE_ASSOC 8
LEVEL1_DCACHE_LINESIZE 64# L2缓存 1048576字节 1048576/(1024**2) 1MB
LEVEL2_CACHE_SIZE 1048576
LEVEL2_CACHE_ASSOC 16
LEVEL2_CACHE_LINESIZE 64# L3缓存 37486592 字节 37486592/(1024**2) = 35.75 MB
LEVEL3_CACHE_SIZE 37486592
LEVEL3_CACHE_ASSOC 11
LEVEL3_CACHE_LINESIZE 64
- 使用伪文件查看L1 data、instruction缓存
# cd /sys/devices/system/cpu/
cat cpu0/cache/index0/level # L1缓存 cpu0代表编号为0的cpu
1
cat cpu0/cache/index0/size # 缓存大小为32KB
32K
cat cpu0/cache/index0/type # 缓存类型为数据缓存
Data
cat cpu0/cache/index0/shared_cpu_list #
0,12 # cd /sys/devices/system/cpu/
cat cpu0/cache/index1/level
1
cat cpu0/cache/index1/size
32K
cat cpu0/cache/index1/type # 缓存类型为指令缓存
Instruction
cat cpu0/cache/index1/shared_cpu_list
0,12# cd /sys/devices/system/cpu/
cat cpu0/cache/index2/level # L2缓存
2
cat cpu0/cache/index2/size # 大小为256KB
256K
cat cpu0/cache/index2/type # L2缓存不分指令缓存和数据缓存
Unified
cat cpu0/cache/index2/shared_cpu_list
0,12# cd /sys/devices/system/cpu/
cat cpu0/cache/index3/level # L3缓存
3
cat cpu0/cache/index3/size
12288K
cat cpu0/cache/index3/type
Unified
cat cpu0/cache/index3/shared_cpu_list
0-5,12-17
5、查看CPU的物理核和逻辑核
intel运用了超线程技术,一个物理核 可以 被虚拟出来两个逻辑核来用
查看物理cpu数量cat /proc/cpuinfo | grep "physical id" | sort | uniq
physical id : 0
physical id : 1查看每个cpu物理核数
cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 6查看系统中所有的逻辑核
及其对应的物理核
cat /proc/cpuinfo | grep -E "core id|process|physical id"
processor : 0
physical id : 0
core id : 0
......
processor : 12
physical id : 0
core id : 0
......
processor : 23
physical id : 1
core id : 10