zoukankan      html  css  js  c++  java
  • linux下查看cpu个数的方法

    在系统文件/proc/cpuinfo记录了关于cpu的信息

    processor    : 0
    vendor_id    : GenuineIntel
    cpu family    : 6
    model        : 58
    model name    : Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
    stepping    : 9
    microcode    : 0x17
    cpu MHz        : 1200.000
    cache size    : 2048 KB
    physical id    : 0
    siblings    : 2
    core id        : 0
    cpu cores    : 2
    apicid        : 0
    initial apicid    : 0
    fpu        : yes
    fpu_exception    : yes
    cpuid level    : 13
    wp        : yes
    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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
    bogomips    : 3791.83
    clflush size    : 64
    cache_alignment    : 64
    address sizes    : 36 bits physical, 48 bits virtual
    power management:
    
    processor    : 1
    vendor_id    : GenuineIntel
    cpu family    : 6
    model        : 58
    model name    : Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
    stepping    : 9
    microcode    : 0x17
    cpu MHz        : 1200.000
    cache size    : 2048 KB
    physical id    : 0
    siblings    : 2
    core id        : 1
    cpu cores    : 2
    apicid        : 2
    initial apicid    : 2
    fpu        : yes
    fpu_exception    : yes
    cpuid level    : 13
    wp        : yes
    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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
    bogomips    : 3791.83
    clflush size    : 64
    cache_alignment    : 64
    address sizes    : 36 bits physical, 48 bits virtual
    power management:

    其中

    process id是逻辑cpu的id

    physical id是物理cpu的id

    cpu cores是每个cpu的核数

    因此

    cat /proc/cpuinfo | grep "physical id" | uniq | wc -l   #可以看出物理cpu的总个数。

    cat /proc/cpuinfo | grep "cpu core" | uniq  #可以看出每个cpu的核数。

    cat /proc/cpuinfo | grep  "processor" | wc -l #可以看出逻辑cpu的个数。

  • 相关阅读:
    Introduction to Mathematical Thinking
    学习 Unix 常用命令
    学习 《UNIX网络编程》
    学习编译并运行C代码
    Introduction to Mathematical Thinking
    Introduction to Mathematical Thinking
    CentOS 6和CentOS 7防火墙的关闭
    centOS 7下无法启动网络(service network start)错误解决办法(应该是最全的了。。。)
    虚拟机中的CentOS 7设置固定IP连接最理想的配置
    使用VMware安装CentOS7详请
  • 原文地址:https://www.cnblogs.com/QicongLiang/p/10318487.html
Copyright © 2011-2022 走看看