性能分析-CPU篇

CPU 常用相关

cpu 概念

cpu 性能问题大致分为两个方向,第一使用率问题。第二调度问题。

使用率表示资源负载情况,而调度问题往往表现文上下文切换,cache命中等问题。

一个实体 CPU 通常会有两个逻辑线程,也就是上图中的 Core 0 和 Core 1。每个 Core 都有自己的 L1 Cache,L1 Cache 又分为 dCache 和 iCache,对应到上图就是 L1d 和 L1i。L1 Cache 只有 Core 本身可以看到,其他的 Core 是看不到的。同一个实体 CPU 中的这两个 Core 会共享 L2 Cache,其他的实体 CPU 是看不到这个 L2 Cache 的。所有的实体 CPU 会共享 L3 Cache。

介质的延迟:https://gist.github.com/jboner/2841832

cpu参数

节拍率

[root@centos7 ~]# grep 'CONFIG_HZ=' /boot/config-$(uname -r)
CONFIG_HZ=1000

每秒可发生中断数量。一般不关心

muma信息

root@centos7 ~]# numactl --hardware
available: 1 nodes (0)
node 0 cpus: 0 1
node 0 size: 3789 MB
node 0 free: 740 MB
node distances:
node   0 
  0:  10 

cpu 个数

#lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 85
Model name:            Intel Xeon Processor (Skylake, IBRS)
Stepping:              4
CPU MHz:               3600.012
BogoMIPS:              7200.02
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
L3 cache:              16384K
NUMA node0 CPU(s):     0,1

cpu数据

# cat /proc/stat | grep ^cpu
cpu  153471 752 141649 325317862 614311 0 6988 3936 0 0
cpu0 56581 392 73373 162665653 319076 0 761 2162 0 0
cpu1 96890 359 68276 162652209 295234 0 6227 1773 0 0

缓存命中率

perf

perf stat -e; perf list

cpu 负载

cpu调度

参考文献:

https://blog.51cto.com/u_13631369/6252413

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值