Interpreting output of cat/proc/cpuinfo
How does one interpret the information printed out by the following command in Linux
cat /proc/cpuinfo
On my laptop, I get the following output:
[gaurish108:~]$ cat /proc/cpuinfo (02-09 15:34) processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 37 model name : Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz stepping : 2 cpu MHz : 933.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no 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 pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat dts tpr_shadow vnmi flexpriority ept vpid bogomips : 4256.49 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 : 37 model name : Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz stepping : 2 cpu MHz : 933.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 1 initial apicid : 1 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no 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 pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat dts tpr_shadow vnmi flexpriority ept vpid bogomips : 4256.40 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 37 model name : Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz stepping : 2 cpu MHz : 933.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 2 cpu cores : 2 apicid : 4 initial apicid : 4 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no 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 pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat dts tpr_shadow vnmi flexpriority ept vpid bogomips : 4256.43 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 37 model name : Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz stepping : 2 cpu MHz : 933.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 2 cpu cores : 2 apicid : 5 initial apicid : 5 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no 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 pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat dts tpr_shadow vnmi flexpriority ept vpid bogomips : 4256.42 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:
Now it says that there are 4 processors on the system. There is also a field inside the information of each processor field which says cou cores are 2.
Does that mean there are 4 Intel i3's CPU's on my system? What does the processor field really mean here?
Solution 1:
The entries are logical processors; objects used by the kernel internally, not necessarily tied to physical devices. (Note that they all have the same physical id
.)
In other words, they represent the four cores of a single Intel i3 CPU.
Also, as noted on this post (which is not exactly a duplicate but closely related), those cores are logical as well – the CPU has two cores physically but supports hyperthreading.
Note that some Intel processors (the i5 included) use hyperthreading, a system where a single processor has (for example) 2 pyhsical cores, but will provide 4 logical cores - allowing the operating system to treat the processor as having more cores than it really does.
If your system has the lscpu
tool (part of recent util-linux), it would output a more human-readable summary of the CPUs installed, for example:
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
Solution 2:
Here is an inline awk script to pretty-print and extract relevant data from /proc/cpuinfo
:
cat /proc/cpuinfo | \
awk -v FS=':' ' \
/^physical id/ { if(nb_cpu<$2) { nb_cpu=$2 } } \
/^cpu cores/ { if(nb_cores<$2){ nb_cores=$2 } } \
/^processor/ { if(nb_units<$2){ nb_units=$2 } } \
/^model name/ { model=$2 } \
\
END{ \
nb_cpu=(nb_cpu+1); \
nb_units=(nb_units+1); \
\
print "CPU model:",model; \
print nb_cpu,"CPU,",nb_cores,"physical cores per CPU, total",nb_units,"logical CPU units" \
}'
Output for a high-performance server:
CPU model: Intel(R) Xeon(R) CPU X5650 @ 2.67GHz
2 CPU, 6 physical cores per CPU, total 24 logical CPU units
Output for a Core i5 laptop:
CPU model: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
1 CPU, 2 physical cores per CPU, total 4 logical CPU units