Linux checks for dual-core (and multicore) CPU information

Source: Internet
Author: User

1. You can get some information about the CPU from the/proc/cpuinfo

[[email protected] dev] # Cat/proc/cpuinfo

processor:0 --Logical CPU ID

Vendor_id:genuineintel

CPU Family:6

Model:26

Model Name:intel (R) Xeon (r) CPU E5504 @ 2.00GHz

Stepping:5

CPU mhz:1995.000

Cache size:4096 KB

physical Id:16 --Physical CPU ID

Siblings:1

Core id:255

CPU Cores:1

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 SS E2 SS HT TM Syscall NX RDTSCP LM PNI Monitor ds_cpl est tm2 cx16 xtpr popcnt lahf_lm

bogomips:3993.24

Clflush size:64

Cache_alignment:64

Address sizes:40 bits physical, bits virtual

Power Management:


Processor:1

Vendor_id:genuineintel

CPU Family:6

Model:26

Model Name:intel (R) Xeon (r) CPU E5504 @ 2.00GHz

Stepping:5

CPU mhz:1596.000

Cache size:4096 KB

Physical id:0

Siblings:1

Core id:255

CPU Cores:1

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 SS E2 SS HT TM Syscall NX RDTSCP LM PNI Monitor ds_cpl est tm2 cx16 xtpr popcnt lahf_lm

bogomips:3990.05

Clflush size:64

Cache_alignment:64

Address sizes:40 bits physical, bits virtual

Power Management:

......


2. Get the number of physical CPUs

[Email protected] dev]# cat/proc/cpuinfo | grep "Physical id" | sort | uniq | wc-l

8


3. Get the number of logical CPUs

[Email protected] dev]# cat/proc/cpuinfo | grep "Processor" | Wc-l


4. The number of cores in each physical CPU: each of the same physical IDS has its corresponding core ID. If the core ID is 1, 2, 3, 4, is the Quad-core CPU, if the core ID is 1, 2, it is dual-core.

[Email protected] dev]# cat/proc/cpuinfo | grep "CPU Cores" | Wc-l

8


5. The number of logical CPUs (possibly cores, threads, or both) in each physical CPU:


# Cat/proc/cpuinfo | grep "Siblings"


It can be either a number of cores or a multiple of the core. When it is equal to the number of cores, it means that each core is a logical CPU, and if it is twice times the core, it means that each core is also enable Hyper-threading (Hyper-thread).

For example: a dual-core hyper-threaded physical CPU with a core ID of 1, 2, but sibling is 4, that is, if two logical CPUs have the same "core ID", then Hyper-threading is turned on.


In summary: What we call the two-core, quad-core is to see the number of physical CPUs.


DMESG | Grep-i ' CPU ' tested many machines and found no results.


Also refer to:

Http://linux.chinaunix.net/techdoc/system/2009/11/28/1146668.shtml



2010-01-08


This article is from the "Five Corners" blog, please be sure to keep this source http://hi289.blog.51cto.com/4513812/1764630

Linux checks for dual-core (and multicore) CPU information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.