1822609 Members
3671 Online
109643 Solutions
New Discussion юеВ

Determing CPU usage

 
Sonison James
Frequent Advisor

Determing CPU usage

Hello,

I would like to monitor the CPU usage. What would be the best command for this? I would like to use the commands top or ps for this but I am having some problems. Firstly the value under "USER" does not seem to be in sync with the CPU usage of the processes. I tried summing up the values in the %CPU column of top and also the %CPU column of ps but in both the cases the sum was > 100% Any info about how these values are to be interpreted would be really valuable.

Thanks and regards
Sonison James
8 REPLIES 8
Sundar_7
Honored Contributor

Re: Determing CPU usage

Hi,

Try

# UNIX95= ps -ef -o user,uid,pid,ppid,pcpu,args | sort -nbk 5

The above command should list all the processes sorted based on their CPU usage.

Thanks,

Sundar.
Learn What to do ,How to do and more importantly When to do ?
Hari Kumar
Trusted Contributor

Re: Determing CPU usage

we have SAR for that
#sar -u 5 100 { for CPU load by user if u have multiple processors u can use M as option)
#sar -q 5 100 ( for run queue load)
# sar -v 5 100 ( for usage of Kernel for each value)
#sar -d 5 100 ( for disk i/o)

# sar -c 5 100
we have also 'b', 'w', options for getting buffer and swap values.
and we also have Glance plus, PRM e.t.c available for CPU usage.
Any way top is always on top for me.

Thanks
Information is Wealth ; Knowledge is Power
Norman_21
Honored Contributor

Re: Determing CPU usage

Hi,

Your best bet is Glance Pluse! Try it for free, it's easier to understand and monitor!

Hope this help!
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
Tim D Fulford
Honored Contributor

Re: Determing CPU usage

Hi

As Xman said GlancePlus Pak (which includes MeasureWare) This has now been re-branded as OpenView Performance Agent. It dies cost but I dont think it is enourmously expensive.

top is good for a quick idea. Your top problems may be fixed in patch PHCO_26020. But Glance or MeasureWare are the dogs b******s, as you can either look at the current state OR the wahat it was like last night. I generally find you get called about a problem that has passed, so MeasureWare is invaluabl in those cases.

Regards

Tim

-
Michael Steele_2
Honored Contributor

Re: Determing CPU usage

Got to go with vamsi mohan on this one. 'sar -u # #' or 'glance advisor' for collecting data.
Support Fatherhood - Stop Family Law
Steven E. Protter
Exalted Contributor

Re: Determing CPU usage

I'm attaching my handy dandy, performance data collection script. It's HP in origin, improved by me. It runs background for any length of time you set.

You'll like it.

based on sar.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jakes Louw
Trusted Contributor

Re: Determing CPU usage

Oy, SEP! Where's that attachment? ;->
Trying is the first step to failure - Homer Simpson