Operating System - HP-UX
1846977 Members
3853 Online
110257 Solutions
New Discussion

%CPU without using the top

 
SOLVED
Go to solution
Madhu Sudhan_1
Respected Contributor

%CPU without using the top

Friends,
I have a requirement of not using top command and to generate similar output (what top gives).
Iam primarily looking for an alternate command like sar. PID, %CPU, TIME, USERNAME fields. sar -u gives me global statistics. Which is not I wanted.

I have done my homework of referring man pages of sar. I haven't found any flags that will help me.

Your help is greatly appreciated.

Thanks,
Allen
Think Positive
9 REPLIES 9
Stefan Farrelly
Honored Contributor

Re: %CPU without using the top


You could use a freeware tool like truespeed;

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/truespeed-0.1.0/

Or you can use HP's own glance, it has options like -adviser_only -syntax which allow you to display a one page list of cpu users to stdout(like top).

Im from Palmerston North, New Zealand, but somehow ended up in London...
James Beamish-White
Trusted Contributor

Re: %CPU without using the top

Have you hit the man pages of vmstat?

And just a FYI, you know you can use top -f to pipe the output to a file?

Cheers!
James
GARDENOFEDEN> create light
Paula J Frazer-Campbell
Honored Contributor

Re: %CPU without using the top

Hi
Have a look at vmstat -n .

Paula
If you can spell SysAdmin then you is one - anon
Stefan Farrelly
Honored Contributor

Re: %CPU without using the top


Heres an even better tool for doing this!

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/yamm-2.6.0/
Im from Palmerston North, New Zealand, but somehow ended up in London...
benoit Bruckert
Honored Contributor

Re: %CPU without using the top

Hi,
I'm a user of vmstat,
this for a global load :
#vmstat | tail -n 1 | awk ' { print "user :"$16" sys:"$17" idle:"$18 }'
Man vmstat for the details and options.
If you want a deteil for user, this the simple ps command, with proper options you will get %cpu, TIMe, for each process, then for each user..

hope that help
Benoit
Une application mal pansée aboutit à une usine à gaze (GHG)
Chris Wilshaw
Honored Contributor
Solution

Re: %CPU without using the top

You could also try

UNIX95= ps -e -opid,pcpu,time,user,args

This will give the pid, %cpu, execution time, userid and command with aarguments

You can then sort this by piping it through

sort -rnk2

which will give the processes in order of $cpu used.

If you wish to use only a subset of processes then the normal flags (-u etc) for the ps command can be used.

Chris
Steve Steel
Honored Contributor

Re: %CPU without using the top

Hi

there are some goo dsolutions here but top with -f is till simplest

ex

top -d 1 -s 1 -n 100 -f /tmp/top

It is there


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Fragon
Trusted Contributor

Re: %CPU without using the top

How about glance plus? It's in HP Application CD, trial version for 60 days only.

-Gerald-
Madhu Sudhan_1
Respected Contributor

Re: %CPU without using the top

This problem is solved. Thank you Chris.

Thanks,
Allen
Think Positive