LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How does ps report CPU on a quad core server? (https://www.linuxquestions.org/questions/linux-newbie-8/how-does-ps-report-cpu-on-a-quad-core-server-656104/)

mike.duffy 07-16-2008 05:34 AM

How does ps report CPU on a quad core server?
 
Good morning,

Runnind redhat 2.6.18-92.el5.

Using command ps -eo pid,pcpu,args | grep PROCESS_NAME

To get the CPU usage for the named process.

Does anyone know if this is returned as a percent of the whole system's CPU or as a percent of the cpu the process is running in?

Thanks in advance.

murugesan 07-16-2008 05:57 AM

The following command
ps -eo pid,pcpu,args
will display the details as:
PID CPU Percentage the process command
Example for the following command:
$ ps -eo pid,pcpu,args | head -n 6
PID %CPU COMMAND
1 0.0 init
2 0.0 [migration/0]
3 0.0 [migration/1]
4 0.0 [migration/2]
5 0.0 [migration/3]
This will list for all the process and the output is redirected as input to head command.
From the head command the first six lines needs to be displayed.
Similarly the command:
ps -eo pid,pcpu,args | grep PROCESS_NAME
will do:
first)
Display for all the process
the output will be redirected to grep command
second)
Display the line containing the name(using grep command) "PROCESS_NAME", if that process (PROCESS_NAME) running.

mike.duffy 07-17-2008 01:53 AM

Thanks for the info but that is not what I am asking. I would like to know if the returned CPU percent is a percentage of the whole CPU of the server of of the actual core the process is running in.

Thanks

syg00 07-17-2008 01:55 AM

The latter - normalized metrics aren't that useful usually.


All times are GMT -5. The time now is 04:38 PM.