LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-20-2010, 07:20 AM   #1
srajeshkumar
LQ Newbie
 
Registered: Jul 2010
Posts: 22

Rep: Reputation: 0
Cool Need help in identifying the number of cores in each processor running


Hi All,

I need your help in identifying the number of cores each processor is running.

I have checked /proc/cpuinfo but i dont find any core details inside it and I can find only no of processor and its speed, please help me on this.

Thanks
 
Old 12-20-2010, 08:40 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
There is a really handy utility, GKrellM (see http://members.dslextreme.com/users/...m/gkrellm.html) that you might find useful -- it shows every core with an indication of how busy it is along with a graph of activity along with other system activity displays. I just start it up and let it run in a corner of the screen and keep an eye on it.

Hope this helps some.
 
Old 12-20-2010, 09:24 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,412

Rep: Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111
Quote:
Originally Posted by srajeshkumar View Post
Hi All,
I need your help in identifying the number of cores each processor is running.
I have checked /proc/cpuinfo but i dont find any core details inside it and I can find only no of processor and its speed, please help me on this.
Thanks
Each 'core' will show up as a separate processor. For example, on my Core i7, I ran "cat /proc/cpuinfo | grep processor" and it shows items 0-7 (8 total devices, one for the actual 'chip', and one for each core). You can also use "dmesg | grep CPU".

Pay attention to what info is in the cpuinfo file...all you're asking for is there.
 
Old 12-20-2010, 10:09 AM   #4
Subject16
Member
 
Registered: Nov 2009
Posts: 46

Rep: Reputation: 1
Chiming in, if you cat /proc/cpuinfo, the specific lines I think you want to look for are physical id (helps you differentiate between the actual physical processors in your system; same physical processor shares same physical id); cpu cores tells you how many cores are on that physical cpu, and core id even tells which core the output is talking about. But specifically for your question the "cpu cores" line in that output oughta tell you what you need to know.
 
Old 12-20-2010, 10:29 AM   #5
Steviepower
Member
 
Registered: May 2010
Location: Eindhoven
Distribution: ubuntu/debian
Posts: 152

Rep: Reputation: 25
this script I found checks how many cores a cpu has and then starts as many tests as there are cores.
Quote:
N=`cat /proc/cpuinfo | grep processor | wc -l`

cat /proc/cpuinfo | grep "model name"
echo
echo "Calculating the first 5000 decimals of pi using $N parallel processes"
TimeBegin=`date +%s.%N`

for ((i=1; i<=$N; i++))
do
echo "scale=5000; 4*a(1)" | bc -l -q > /dev/null &
done
wait

TimeEnd=`date +%s.%N`
DT=`echo "scale=2; ($TimeEnd - $TimeBegin) / 1" | bc`
echo "Total time: $DT seconds"
DTc=`echo "scale=2; ($TimeEnd - $TimeBegin) / $N" | bc`
echo "Average time per calculation: $DTc seconds"
I think what you're looking for is N

I don't really know what TB0ne here means with one for each core and one for each processor. but it just shows the cpu cores that are presented to the kernel to do their work on. if you have 1 cpu with 2 cores it says 2 if you have 2 cpu's with 1 core it says 2 and if you have 1 cpu and one core with hyperthreading it says 2 as well. if you have 2 cpu's with 6 cores and hyperthreading on all of them it says 24. so all you need to do to know the actual number of cores is this and divide it by two if you have hyperthreading.
You can check this by seeing if the cpu has the ht flag.
 
1 members found this post helpful.
Old 12-20-2010, 11:13 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,412

Rep: Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111
Quote:
Originally Posted by Steviepower View Post
this script I found checks how many cores a cpu has and then starts as many tests as there are cores.


I think what you're looking for is N

I don't really know what TB0ne here means with one for each core and one for each processor. but it just shows the cpu cores that are presented to the kernel to do their work on. if you have 1 cpu with 2 cores it says 2 if you have 2 cpu's with 1 core it says 2 and if you have 1 cpu and one core with hyperthreading it says 2 as well. if you have 2 cpu's with 6 cores and hyperthreading on all of them it says 24. so all you need to do to know the actual number of cores is this and divide it by two if you have hyperthreading.
You can check this by seeing if the cpu has the ht flag.
+1. Good post, Steviepower.
 
Old 12-21-2010, 06:17 AM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by Steviepower View Post
This script I found checks how many cores a cpu has and then starts as many tests as there are cores. You can check this by seeing if the cpu has the ht flag.
For Intel CPUs, otherwise it can mean HyperTransport: http://blog.incase.de/index.php/cpu-...heir-meanings/ And HyperThreading may also be switched off in the BIOS, but the flag will still be output.

If the original poster is looking for something like the topology, I would just like to note, that in the GridEngine package the tool loadcheck will output something like:
Code:
$ /usr/sge/utilbin/lx24-amd64/loadcheck 
arch            lx24-amd64
num_proc        8
m_socket        2
m_core          8
m_topology      SCCCCSCCCC
...
 
1 members found this post helpful.
Old 12-23-2010, 09:52 AM   #8
Steviepower
Member
 
Registered: May 2010
Location: Eindhoven
Distribution: ubuntu/debian
Posts: 152

Rep: Reputation: 25
ok I didn't know that, good you do.
 
  


Reply


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
missing number of cores in according to /proc/cpuinfo centguy Linux - Software 14 01-10-2010 10:22 PM
Find number of cores in my processor ttsdinesh Linux - Newbie 8 12-02-2009 07:16 AM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:58 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
Open Source Consulting | Domain Registration