LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-19-2010, 02:38 AM   #1
chamila1986
Member
 
Registered: Oct 2009
Posts: 31

Rep: Reputation: 15
Question Get load average for cpu core


How to get the load average for each CPU core in multi core(eg:duel core machine) processor environment. I tried using,

Code:
1. cat /proc/loadavg 
2. uptime
3. top
But all of those commands gives the load average for whole system but not particular CPU core. Are there a way to take the load average for CPU core(Or any mechanism that can be done programmatic manner).
 
Old 05-19-2010, 02:40 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Did you try top and use the 1 option? This should show all cpu's/cores instead of a single entry (avg cpu).

Hope this helps.
 
Old 05-19-2010, 03:05 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,188

Rep: Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131Reputation: 4131
Conceptually you should be able to get those numbers per (scheduler) namespace. On a true NUMA machine that would be per node, and in a container environment, per cgroup (presuming all cgroups contained only complete cpu/core).
I'm not aware if the numbers are indeed maintained at that level.
 
Old 05-19-2010, 05:07 AM   #4
chamila1986
Member
 
Registered: Oct 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Unhappy

Sir druuna,
'top' with 1 gives only cpu core utilisation. Not the load average for each CPU core...

Any other solution please....
 
Old 05-19-2010, 05:13 AM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You can try the
Code:
mpstat
command (think it's part of the sysstat package so you might need to install that). Maybe that'll show you what you want/need.

Kind regards,

Eric
 
Old 05-19-2010, 05:14 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Do you see any difference when using the 1 in top? It should show all cpu/cores (take a look here for an example [picture, enlarge it]).

If installed, you could try the sar/mpstat command to get this information (maybe this link will help).

Hope this helps.
 
Old 05-19-2010, 05:40 AM   #7
chamila1986
Member
 
Registered: Oct 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Unhappy

Sir druuna,EricTRA and ALL,

This shows the CPU usage for each core(Core0 and Core1) but it doesn't give the load average of each CPU core...So are there an equation to find out the load average using given facts.

I tried 'mpstat' but it doesn't give the load average for each CPU core.

Code:
ucsc@desktop-15:~$ mpstat -P ALL
Linux 2.6.31-21-generic (desktop-15) 	05/19/2010 	_i686_	(2 CPU)

04:08:14 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
04:08:14 PM  all    1.34    0.01    0.37    1.08    0.01    0.01    0.00    0.00   97.19
04:08:14 PM    0    1.18    0.01    0.36    1.07    0.01    0.01    0.00    0.00   97.35
04:08:14 PM    1    1.50    0.00    0.37    1.08    0.01    0.01    0.00    0.00   97.04
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU Load average higher than Percentage? brittonv Linux - Server 9 04-20-2010 08:29 PM
load average and cpu usage too high, why could i do? v_fone Linux - Newbie 5 07-02-2009 03:17 AM
How can I get the system's cpu Load Average by c. davyzhang Programming 12 08-03-2007 07:51 AM
Load average stuck at 7.00, CPU usage ~ 0.1%, what gives? BrianK Linux - General 4 02-16-2004 08:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:25 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