天天看點

linux下檢視CPU資訊

總核數 = 實體CPU個數 * 每個實體CPU上的核數

總邏輯CPU總數 = 實體CPU個數 * 每個實體CPU上的核數 (cpu cores)*  超線程數(與CPU架構有關,支援并開啟ht)

檢視-實體CPU個數

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

檢視-每個實體CPU上的核數

cat /proc/cpuinfo| grep "cpu cores"| uniq      

檢視邏輯CPU個數

cat /proc/cpuinfo |grep "processor"|sort |uniq |wc -l      

是否開啟intel的超線程技術(ht)

如果有兩個邏輯CPU具有相同的"core id",那麼超線程是打開的。

也可以根據以下原則,來判斷是否支援HT技術。如果"siblings"和"cpu cores"一緻,則說明不支援超線程,或者超線程未打開;如果"siblings"是"cpu cores"的兩倍,則說明支援超線程,并且超線程已打開。

linux下檢視CPU資訊

 /proc/cpuinfo檔案分析

 cpu family  :6

model    :26

model name :Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz

stepping    :5

cpu MHz    :1600.000

cache size  : 8192 KB

physical id  :0

siblings    :8

core id     : 0

cpu cores   :4

apicid         :0

fpu       :yes

fpu_exception :yes

cpuid level   : 11

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 syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm

bogomips   :4522.12

clflush size  :64

cache_alignment  : 64

address sizes    : 40 bits physical, 48 bits virtual

power management :

以上輸出項的含義如下:

processor :系統中邏輯處理核的編号。對于單核處理器,則課認為是其CPU編号,對于多核處理器則可以是實體核、或者使用超線程技術虛拟的邏輯核

vendor_id :CPU制造商     

cpu family :CPU産品系列代号

model   :CPU屬于其系列中的哪一代的代号

model name:CPU屬于的名字及其編号、标稱主頻

stepping   :CPU屬于制作更新版本

cpu MHz   :CPU的實際使用主頻

cache size   :CPU二級緩存大小

physical id   :單個CPU的标号

siblings       :單個CPU邏輯實體核數

core id        :目前實體核在其所處CPU中的編号,這個編号不一定連續

cpu cores    :該邏輯核所處CPU的實體核數

apicid          :用來區分不同邏輯核的編号,系統中每個邏輯核的此編号必然不同,此編号不一定連續

fpu             :是否具有浮點運算單元(Floating Point Unit)

fpu_exception  :是否支援浮點計算異常

cpuid level   :執行cpuid指令前,eax寄存器中的值,根據不同的值​​​cpuid​​​指令會傳回不同的内容

wp             :表明目前CPU是否在核心态支援對使用者空間的寫保護(Write Protection)

flags          :目前CPU支援的功能

​​​bogomips​​​   :在系統核心啟動時粗略測算的CPU速度(Million Instructions Per Second)

clflush size  :每次重新整理緩存的大小機關

cache_alignment :緩存位址對齊機關

address sizes     :可通路位址空間位數

power management :對能源管理的支援

參考文檔:​

 cpu family  :6

model    :26

model name :Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz

stepping    :5

cpu MHz    :1600.000

cache size  : 8192 KB

physical id  :0

siblings    :8

core id     : 0

cpu cores   :4

apicid         :0

fpu       :yes

fpu_exception :yes

cpuid level   : 11

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 syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm

bogomips   :4522.12

clflush size  :64

cache_alignment  : 64

address sizes    : 40 bits physical, 48 bits virtual

power management :

以上輸出項的含義如下:

繼續閱讀