linux 查询系统CPU核数、线程数 您所在的位置:网站首页 查看电脑是几核的 linux 查询系统CPU核数、线程数

linux 查询系统CPU核数、线程数

2024-07-12 09:23| 来源: 网络整理| 查看: 265

1. 查看CPU型号

~$ cat /proc/cpuinfo | grep name | sort | uniq model name : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz

2. 查看物理CPU数目

~$ cat /proc/cpuinfo | grep "physical id" physical id : 0 physical id : 0 physical id : 0 physical id : 0 physical id : 0 physical id : 0 physical id : 0 physical id : 0

 

所有physical id都是0,可知有1个物理CPU;也用管道排序去重后直接输出物理cpu的个数:

~$ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 1

3. 查看核数和逻辑CPU数目

   CPU核数和线程数可以用类似方法

~$ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 1 ~$ cat /proc/cpuinfo | grep "core id" | sort | uniq | wc -l 4 ~$ cat /proc/cpuinfo | grep "processor" | sort | uniq | wc -l 8

  由图可知:1颗物理CPU,4核8线程;

4 . 如果不想自己算,也可以直接lscpu

~$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 94 Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz Stepping: 3 CPU MHz: 900.055 CPU max MHz: 3500.0000 CPU min MHz: 800.0000 BogoMIPS: 5184.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 6144K NUMA node0 CPU(s): 0-7 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d

只有1个cpu,4核,支持超线程即每个核对应2个线程,共有8个逻辑线程。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有