Operating System - HP-UX
1748177 Members
4231 Online
108758 Solutions
New Discussion юеВ

Re: Process and CPU information

 
SOLVED
Go to solution
G V R Shankar
Valued Contributor

Process and CPU information

Hi All,

Following command, prints the unique values of CPU numbers.

ps -ef|awk '{print $4}'|sort -r |uniq

C
3
20
2
12
1
0

In my system, I have CPU0, CPU1, CPU2, CPU4, CPU6 and CPU7.

I don't uderstand the CPU numbers 20,12,3 which are not present in my system.

Could you please explain about this?

Ravi
11 REPLIES 11
rariasn
Honored Contributor

Re: Process and CPU information

Hi Ravi,

C isn't the number of cpu's.

%cpu %CPU cpu utilization of the process in "##.#" format.

Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage. It will not add up to 100% unless you are lucky. (alias pcpu).


Rgs,
Pete Randall
Outstanding Contributor

Re: Process and CPU information

A quick review of the man page indicates that this "C" column indicates the "processor utilization for scheduling". I think you've mis-interpreted.


Pete

Pete
rariasn
Honored Contributor

Re: Process and CPU information

Yes,

pcpu

The percentage of CPU time used by this process during the last scheduling interval. The default heading for this column is %CPU.

Regards,
Dennis Handly
Acclaimed Contributor

Re: Process and CPU information

> ... | sort -r | uniq

No need to use uniq(1) here, you can use: ... | sort -r -u
G V R Shankar
Valued Contributor

Re: Process and CPU information

Hi All,

I am sorry, I could have presented my question in more approprite way. Even it is my understanding that CPU cloumn would show the CPU number, instead of number of CPU's.

In my system, I have CPU0, CPU1, CPU2, CPU4, CPU6 and CPU7. In that case, ps -ef o/p shoudl have 0,1,2,4,6 and 7. Please correct me if I am wrong.

Apart from that, I see 20, 12 and 3 numbers in CPU column.

I have little knowledge about pcpu, but I am interested in the CPU cloumn.

Cheers,

Ravi.
Pete Randall
Outstanding Contributor

Re: Process and CPU information

> it is my understanding that CPU cloumn would show the CPU number, instead of number of CPU's.

That is wrong. The CPU column shows processor utilization not processor number.

>Please correct me if I am wrong.

You are wrong (see above).


Pete

Pete
Dennis Handly
Acclaimed Contributor

Re: Process and CPU information

>Following command, prints the unique values of CPU numbers.

Are you thinking of the CPU number in the top(1) output?
G V R Shankar
Valued Contributor

Re: Process and CPU information

Thank you for correcting me. I was in a impresession that it was the CPU number as shown top command.

Out of 6 CPU's, if 2 CPU's utilization is above 90% (as per OVPA reports), how do I know which processes are keeping those 2 CPU's busy.

Can you please help me?

Ravi.
Dennis Handly
Acclaimed Contributor
Solution

Re: Process and CPU information

>if 2 CPU's utilization is above 90% (as per OVPA reports), how do I know which processes are keeping those 2 CPUs busy?

Doesn't top(1) tell you which process is busy and using which CPU? (Provided you aren't using threads.)
Any reason you care?