LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 03-05-2012, 02:44 PM   #1
mikes88
Member
 
Registered: Jan 2012
Posts: 61

Rep: Reputation: Disabled
CPU cores usage


Hello,

Trying to figure out if there is a way to view all the cores that a process is using in linux and how much of that core it is using. Need to be able to run this command for a day and output the information to a file to be analyzed.

If anyone has any insight or any scripts for this please let me know.

Thanks
 
Old 03-06-2012, 07:09 AM   #2
Slackyman
Member
 
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
Code:
pidstat -p PID -T ALL
Where PID is the Process ID of the task you want to monitor and the -T ALL option monitor all the children too.
Look at the output:
Code:
14:08:00          PID    %usr %system  %guest    %CPU   CPU  Command
14:08:00         2187    0,06    0,08    0,00    0,15     2  X

14:08:00          PID    usr-ms system-ms  guest-ms  Command
14:08:00         2187     15100     19500         0  X
the CPU value is the CPU core used at that time by that task.
You can use this in scripting launching the command every second (or fraction) and write the output to a file.
 
Old 03-06-2012, 10:42 AM   #3
mikes88
Member
 
Registered: Jan 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
i used the command ps -p PID -L -o pid,psr,pcpu becuase pidstats wasnt on the system. It worked fine and posted the info

Quote:
PID PSR %CPU
3874 2 0.0
3874 1 0.1
3874 - 0.0
3874 2 0.0
3874 2 0.2
3874 4 0.1
3874 5 0.2
3874 6 0.0
3874 7 0.0
3874 2 0.0
Now when i try and run it on another system i get the following output:

Quote:
PID PSR %CPU
874 - 0.0
874 - 0.2
874 - 0.0
874 - 1.5
874 - 0.3
ANyone have any insight on that?
 
Old 03-06-2012, 12:21 PM   #4
Slackyman
Member
 
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
Quote:
Originally Posted by mikes88 View Post
Now when i try and run it on another system i get the following output
Which distro?
 
Old 03-06-2012, 01:16 PM   #5
mikes88
Member
 
Registered: Jan 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
Sun os 5.10
 
Old 03-06-2012, 01:25 PM   #6
Slackyman
Member
 
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
From what I know SunOS 5 was released in 1993/94 then changed its name to Solaris.
Are you talking about Solaris or the ORIGINAL SunOS?!?
Anyway, I worked on Solaris systems in 1998-2000 and at that time there ain't no multicore CPU (but there were servers with more than one CPU)
I can't figure out why it doesn't show PSR info.
 
Old 03-06-2012, 02:16 PM   #7
mikes88
Member
 
Registered: Jan 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
i see..well.. if you know of any other commands that would help me get what im looking for id really appreciate it.
 
Old 03-20-2012, 05:44 PM   #8
steveparker
LQ Newbie
 
Registered: Mar 2012
Location: Manchester, UK
Posts: 5

Rep: Reputation: Disabled
Check out nmon if on AIX/Linux (http://www.ibm.com/developerworks/ai...u-analyze_aix/) or Sarmon (http://www.geckotechnology.com/fr/sarmon) on Solaris
 
  


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
[SOLVED] Are all of my CPU-cores working? Weapon S Linux - Hardware 6 02-04-2012 09:32 AM
View/Disable CPU cores Thalha Rahim Solaris / OpenSolaris 3 12-18-2011 02:21 PM
How does software know how to use Multiple CPU and Cores Ronayn Linux - Software 4 12-20-2010 05:36 AM
Software and CPU Cores DIGITAL39 Linux - Software 8 10-10-2007 02:47 AM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 04:49 AM.

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