Operating System - Linux
1747990 Members
4912 Online
108756 Solutions
New Discussion юеВ

Re: find CPU, SIZE and RES for a specific process on HP-UX

 
rtiw
New Member

find CPU, SIZE and RES for a specific process on HP-UX

Hi,

I want to find CPU, SIZE and RES information for a specific process on HP-UX 11i V1 platform.

I can see that 'top' command provides all this information, but here one has to navigate on diffrent screen to get stats of process of interest.

I would like to know if there is some command in HP-UX like 'prstat' command in Solaris which can be used to get stats of specific process

Solaris example:
prstat -p 15373 1 1

gives following
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
15373 usr1 271M 141M sleep 59 0 0:51:39 0.2% java/45


I tried using 'ps -p -o sz,vsz' on HP-UX for a process but the information displayed here is not same as SIZE and RES info displayed by top command.

7 REPLIES 7
Jeeshan
Honored Contributor

Re: find CPU, SIZE and RES for a specific process on HP-UX

try this command

#export UNIX95=1;ps -ef -o comm,pcpu,vsz,args | grep

a warrior never quits
Don Morris_1
Honored Contributor

Re: find CPU, SIZE and RES for a specific process on HP-UX

One thing to note (I think ps is the quickest method as well) is that the sizes likely won't match -- because the units reported differ.

top is reporting the values in Mb/Kb/Gb [whatever it wants to really], hiding the conversion from kb or page units that it gets from the underlying mechanism. ps() is more directly reporting exactly what that mechanism (pstat) gives... and as such, sz is in pages and vsz is in kb. You'll want to account for that mentally (if the point is to read it yourself) or write a wrapping script / C program to convert it to something more suitable as top would.

This has been discussed many times before, and as such -- I'm sure there are many scripts/programs out there that may be really close to what you want [perhaps even exactly]. Try looking through:
https://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1183183

Don
rtiw
New Member

Re: find CPU, SIZE and RES for a specific process on HP-UX

Hi Don,

Thanks for your response.

I would like to rephrase my query. Actually i wanted to analyse system resource (cpu and memory (SIZE and RES)) usage stats by a particular process over a period of time.

top command provides SIZE (which is total virtual size of process in KBytes), RES (Resident size of the process in KBytes), CPU info along with some other process details also.

The problem with using top command is that it lists all top processes details at given point of time. I am interested in collecting the same stats as displayed by top command but for a specific process repititively at regular interval of times.

It is possible in Solaris with prstat command.

Please could you suggest if its possible to get stats displayed by top command for a particular process using either 'top' command or some other command.

Thanks.
Don Morris_1
Honored Contributor

Re: find CPU, SIZE and RES for a specific process on HP-UX

Yes, as I pointed you to in that thread, there's a shell script there which will report SIZE and RES for a given pid or a C program (yeah, with a couple printf format conversion warnings I should fix one of these days) which will do the same [using the -p option]. Running it at various times could be done with a simple:

while true
do
pseudo-prstat -p
sleep 5
done

or a shell script, or cron... or whatever you want. (And if you want this in a file pipe it there, etc.)

Just compile the program or copy the script, name the file whatever you want and use it.

(Or if you know C just revise the program to take a loop option and report N times or whatnot.)

There's no stock command that I know of or option to top that looks just like prstat as you've shown.... but it isn't hard to set up your own once you have a way to get the pstat data.
Steven E. Protter
Exalted Contributor

Re: find CPU, SIZE and RES for a specific process on HP-UX

Shalom,

http://www.hpux.ws/?p=8

That script or a slight modification should give you what you want.

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
Mridul Shrivastava
Honored Contributor

Re: find CPU, SIZE and RES for a specific process on HP-UX

Do you have glance ?

using glance it is possible to achieve what u need.. system resources can be monitored for a period and even graph can be created using that.

Please refer the following doc for more details on the same:

http://docs.hp.com/en/B8733-90021/index.html
Time has a wonderful way of weeding out the trivial
Mridul Shrivastava
Honored Contributor

Re: find CPU, SIZE and RES for a specific process on HP-UX

Do you have glance/scopeux ?

using glance it is possible to achieve what u need.. system resources can be monitored for a period and even graph can be created using that.

Please refer the following doc for more details on the same:

http://docs.hp.com/en/B8733-90021/index.html
Time has a wonderful way of weeding out the trivial