LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-02-2009, 06:23 AM   #1
ttsdinesh
LQ Newbie
 
Registered: Jun 2009
Location: Erode,TN,India
Distribution: Ubuntu
Posts: 13

Rep: Reputation: 0
Question Find number of cores in my processor


I need to find the number of cores in my processor. I used
Quote:
/proc/cpuinfo
. But i cant get the number of cores. Can somebody help me? thanks in advance....
 
Old 12-02-2009, 06:27 AM   #2
sv*
LQ Newbie
 
Registered: Dec 2009
Distribution: CentOS, LinuxMint, Mandriva, Slackware
Posts: 6

Rep: Reputation: 0
The same command works in my case. I used along with 'cat' though.
Code:
cat /proc/cpuinfo
Here is my output, is the info you are looking present?
Code:
[root@mandriva sv]# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 15
model name	: Intel(R) Core(TM)2 Duo CPU     T5270  @ 1.40GHz
stepping	: 13
cpu MHz		: 800.000
cache size	: 2048 KB
physical id	: 0
siblings	: 2
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	: 10
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 lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm ida
bogomips	: 2791.74
clflush size	: 64
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 15
model name	: Intel(R) Core(TM)2 Duo CPU     T5270  @ 1.40GHz
stepping	: 13
cpu MHz		: 800.000
cache size	: 2048 KB
physical id	: 0
siblings	: 2
core id		: 1
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	: 10
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 lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm ida
bogomips	: 2792.20
clflush size	: 64
power management:

Last edited by sv*; 12-02-2009 at 06:30 AM.
 
Old 12-02-2009, 06:32 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

You need to look for the following entries in the output of /proc/cpuinfo:

physical id and siblings

The example in post #2 is one processor with 2 cores.

The next example has 2 processors, both have 4 cores:
Quote:
# cat cpuinfo | egrep "physical|sibling"
physical id : 0
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
physical id : 1
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
physical id : 0
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
physical id : 1
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
physical id : 0
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
physical id : 1
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
physical id : 0
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
physical id : 1
siblings : 4
address sizes : 38 bits physical, 48 bits virtual
And there is, of course, the cpu cores, which I overlooked in my initial answer.....

Hope this helps.
 
Old 12-02-2009, 06:48 AM   #4
ttsdinesh
LQ Newbie
 
Registered: Jun 2009
Location: Erode,TN,India
Distribution: Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
But i am geting the following output:
Quote:
ubuntu@ubuntu:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Pentium(R) D CPU 2.66GHz
stepping : 8
cpu MHz : 2661.550
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
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 constant_tsc up pebs bts tsc_reliable pni ds_cpl
bogomips : 5323.10
clflush size : 64
power management:

ubuntu@ubuntu:~$
Number of cores are not displayed.I am running ubuntu in VMWare. Will that cause any difference?
 
Old 12-02-2009, 06:52 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

I do believe that if you run from inside a virtual machine you do not get the info about the real cpu(s) present (when using /proc/cpuinfo).

Have a look if /proc/vmware/cpuinfo exists and if it does, check that one.

Hope this helps.
 
Old 12-02-2009, 06:58 AM   #6
ttsdinesh
LQ Newbie
 
Registered: Jun 2009
Location: Erode,TN,India
Distribution: Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Mr.druuna, /proc/vmware/cpuinfo doesnt work. let me try outside virtual machine. Then, how to display core alone? i mean, how to parse the output?
 
Old 12-02-2009, 07:06 AM   #7
cola
Senior Member
 
Registered: Sep 2007
Location: Dhaka,Bangladesh
Distribution: Debian
Posts: 1,031

Rep: Reputation: 63
Quote:
Originally Posted by ttsdinesh View Post
Mr.druuna, /proc/vmware/cpuinfo doesnt work. let me try outside virtual machine. Then, how to display core alone? i mean, how to parse the output?
Yes,try from outside vmwire and post result
Code:
cat /proc/cpuinfo
 
Old 12-02-2009, 07:08 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

I would grep both cpu cores and physical id, this to make sure that if you have more then one cpu you will notice:

egrep "physical id|cpu cores" /proc/cpuinfo

The above command will show only those 2 fields (which could show up multiple times).

If the physical id field only has one number (0 / zero) you have one cpu, if you see 0 and 1 you have 2 cpu's.
The cpu cores filed shows the amount of cores for one cpu.

If cpu cores says 4 and you have both 0 and 1 entries for physical id, you have 8 cores in total.

BTW: No Mr. needed
 
1 members found this post helpful.
Old 12-02-2009, 07:16 AM   #9
ttsdinesh
LQ Newbie
 
Registered: Jun 2009
Location: Erode,TN,India
Distribution: Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Thank u for ur help.
 
  


Reply

Tags
cpu, info


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Quad processor cores vs. 4 processors. mandrakethepenguin Linux - Hardware 12 08-14-2008 04:05 PM
LXer: Configurable, extensible processor cores run Linux LXer Syndicated Linux News 0 12-05-2006 07:54 AM
how to find number of cores in CPU narensr Linux - Hardware 5 08-24-2006 02:09 PM
find out the processor speed ashley75 Linux - General 2 12-29-2005 01:03 PM
how to find processor time. bruse Linux - Newbie 3 07-15-2005 11:13 AM


All times are GMT -5. The time now is 09:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration