Is enable Hyperthread or not?

怎麼知道有沒有啟動 Hyperthread dmidecode 可以判斷!

user@T:~$ sudo dmidecode -t processor | grep HTT
    HTT (Multi-threading)
    user@T:~$ grep '^flags\b' /proc/cpuinfo | tail -1
    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 nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid

看看實際上有多少CPU

user@T:~/work_house/partclone$ sudo dmidecode -t processor|grep "Version:"
[sudo] password for thomas: 
    Version: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz

再來就是看 cpuinfo 有沒有 ht 這個 flag(參考用)

user@T:~$ grep '^flags\b' /proc/cpuinfo | tail -1 | grep ht
    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 nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid

最後就是看 cpuinfo 中 processor 與 physical id 的配對

user@T:~$ egrep -i "processor|physical id|core id" /proc/cpuinfo
processor   : 0
physical id : 0
core id : 0
processor   : 1
physical id : 0
core id : 0
processor   : 2
physical id : 0
core id : 1
processor   : 3
physical id : 0
core id : 1

這邊就可以看到都用同一個實體CPU(physical id▸: 0),有兩個 core (id為0, 1),HT 之後有 4 個 process

Comments