dmesg
(display message或者driver message)是Linux系統中用于顯示內核啟動信息和運行時狀態的命令。在dmesg
的輸出中,關于CPU的信息通常包括以下幾個方面:
以下是一個簡化的dmesg
輸出示例,展示了部分CPU信息:
[ 0.000000] Linux version 5.4.0-42-generic (buildd@lgw01-amd64-039) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-42-generic root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ro quiet splash vt.handoff=7
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
[ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'compacted' format.
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bffaffff] usable
...
[ 0.000000] CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz (68 95 9 0 0 0)
[ 0.000000] On another node:
[ 0.000000] CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz (68 95 9 0 0 0)
...
[ 0.000000] CPU: Physical Processor ID 0
[ 0.000000] CPU: Processor Core ID 0
...
[ 0.000000] CPU: Logical Processor ID 0
[ 0.000000] smpboot: CPU0: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz (family: 0x6, model: 0x9e, stepping: 0x9)
[ 0.000000] Performance Events: PEBS fmt3+, Hallmark event, 32-deep LBR, full-width counters, Intel PMU driver.
...
Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
68 95 9 0 0 0
可以推斷出是6核12線程(每個物理核心有兩個邏輯核心)。dmesg
的輸出可能會因系統和硬件的不同而有所差異。lscpu
)來獲取更詳細的解釋。通過分析dmesg
中的CPU信息,可以幫助診斷硬件兼容性問題、性能瓶頸以及潛在的系統故障。