linux系统中查看逻辑cpu个数、物理cpu个数、每个cpu的核心数、cpu型号

 

1、逻辑cpu个数(线程数)

[root@centos79 test]# cat /proc/cpuinfo | grep "processor"
processor       : 0
processor       : 1
processor       : 2
processor       : 3
[root@centos79 test]# cat /proc/cpuinfo | grep "processor" | wc -l
4

 

2、物理cpu个数

复制代码
[root@centos79 test]# cat /proc/cpuinfo | grep "physical id"
physical id     : 0
physical id     : 0
physical id     : 1
physical id     : 1
[root@centos79 test]# cat /proc/cpuinfo | grep "physical id" | sort | uniq -c
      2 physical id     : 0
      2 physical id     : 1
[root@centos79 test]# cat /proc/cpuinfo | grep "physical id" | sort | uniq -c | wc -l
2
复制代码

 

3、查看每个cpu核心数

[root@centos79 test]# cat /proc/cpuinfo | grep "cpu cores"
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
[root@centos79 test]# cat /proc/cpuinfo | grep "cpu cores" | uniq | awk -F: '{print $2}'
 2

 

4、查看cpu型号

[root@centos79 test]# dmidecode -s processor-version | uniq
AMD Ryzen 5 3600X 6-Core Processor

 

 

5、汇总

复制代码
[root@centos79 test]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4     ## 逻辑cpu个数
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    2     ## 每个cpu核心数
Socket(s):             2     ## 物理cpu个数
NUMA node(s):          1
Vendor ID:             AuthenticAMD
CPU family:            23
Model:                 113
Model name:            AMD Ryzen 5 3600X 6-Core Processor   ## cpu型号
Stepping:              0
CPU MHz:               3800.009
BogoMIPS:              7600.01
Virtualization:        AMD-V
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              512K
L3 cache:              32768K
NUMA node0 CPU(s):     0-3
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl tsc_reliable nonstop_tsc extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core retpoline_amd ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec clzero arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists overflow_recov succor
复制代码

 

posted @   小鲨鱼2018  阅读(1032)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示