Re: CPU consumed by a Process (157 Views)
Reply
Advisor
Cenoce_2
Posts: 22
Registered: ‎06-29-2005
Message 1 of 12 (157 Views)
Accepted Solution

CPU consumed by a Process

Hi all,

Supose if i know a process id then how to find out CPU consumed by that process.
Please use plain text.
Honored Contributor
Robert-Jan Goossens
Posts: 7,384
Registered: ‎04-04-2000
Message 2 of 12 (157 Views)

Re: CPU consumed by a Process

Hi,

# UNIX95= ps -eo pcpu,pid,args | grep PID

Regards,
Robert-Jan
Please use plain text.
Honored Contributor
Arunvijai_4
Posts: 4,194
Registered: ‎04-07-2005
Message 3 of 12 (157 Views)

Re: CPU consumed by a Process

Hello,


# UNIX95= ps -ef -o pid,ruser,pcpu,args|tr -d "%" |awk '{if($4>=90) print $0}'

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Please use plain text.
Esteemed Contributor
Mark Nieuwboer
Posts: 409
Registered: ‎08-06-2001
Message 4 of 12 (157 Views)

Re: CPU consumed by a Process

Hi Cenoce,

Use glance

grtz. Mark
Please use plain text.
Honored Contributor
Yogeeraj_1
Posts: 4,613
Registered: ‎11-25-2001
Message 5 of 12 (157 Views)

Re: CPU consumed by a Process

hi,

you can use Glance Plus.

e.g.
--------------------------------------------------------------------------------
Resources PID: 19711, rwrun PPID: 16127 euid: 124 User: ias
--------------------------------------------------------------------------------
CPU Usage (util): 41.3 Log Reads : 735 Wait Reason : PRI
User/Nice/RT CPU: 39.7 Log Writes: 0 Total RSS/VSS : 28.0mb/ 30.0mb
System CPU : 0.4 Phy Reads : 0 Traps / Vfaults: 969/ 0
Interrupt CPU : 0.8 Phy Writes: 0 Faults Mem/Disk: 0/ 0
Cont Switch CPU : 0.0 FS Reads : 0 Deactivations : 0
Scheduler : HPUX FS Writes : 0 Forks & Vforks : 0
Priority : 243 VM Reads : 0 Signals Recd : 0
Nice Value : 21 VM Writes : 0 Mesg Sent/Recd : 359/ 359
Dispatches : 1345 Sys Reads : 0 Other Log Rd/Wt: 360/ 359
Forced CSwitch : 905 Sys Writes: 0 Other Phy Rd/Wt: 0/ 0
VoluntaryCSwitch: 359 Raw Reads : 0 Proc Start Time
Running CPU : 1 Raw Writes: 0 Thu Feb 9 14:26:03 2006
CPU Switches : 73 Bytes Xfer: 0kb :


hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Please use plain text.
Honored Contributor
Arunvijai_4
Posts: 4,194
Registered: ‎04-07-2005
Message 6 of 12 (157 Views)

Re: CPU consumed by a Process

Hello,

You can also use "top" .

"A ship in the harbor is safe, but that is not what ships are built for"
Please use plain text.
Honored Contributor
Muthukumar_5
Posts: 4,030
Registered: ‎06-09-2004
Message 7 of 12 (157 Views)

Re: CPU consumed by a Process

You can use like,

UNIX95= ps -ef -o pid,comm,cpu,cpu | grep 'pid of process'

--
Muthu
Easy to suggest when don't know about the problem!
Please use plain text.
Honored Contributor
Muthukumar_5
Posts: 4,030
Registered: ‎06-09-2004
Message 8 of 12 (157 Views)

Re: CPU consumed by a Process

you can use top but it may not be accurate always. Some times process will not be coming in list. Better go with UNIX95 for default or use glanceplus.

--
Muthu
Easy to suggest when don't know about the problem!
Please use plain text.
Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 9 of 12 (157 Views)

Re: CPU consumed by a Process

http://www.hpux.ws/system.perf.sh

sar packages that run background for as long as you designate.

This is a complete package that started out from HP and were fixed/improved by me.

Any reason why the replies to this thread are broken into such small pieces?

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
Please use plain text.
Advisor
Cenoce_2
Posts: 22
Registered: ‎06-29-2005
Message 10 of 12 (157 Views)

Re: CPU consumed by a Process

Thanks all

Can anybody explain how UNIX95 works
Please use plain text.
Honored Contributor
Yogeeraj_1
Posts: 4,613
Registered: ‎11-25-2001
Message 11 of 12 (157 Views)

Re: CPU consumed by a Process

see:
http://ou800doc.caldera.com/en/DIFFS/UNIX95_Conformance.html

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Please use plain text.
Honored Contributor
Bill Hassell
Posts: 14,205
Registered: ‎05-29-2000
Message 12 of 12 (157 Views)

Re: CPU consumed by a Process

A couple of notes:

There is no need to use grep with ps, especially when looking for a specific PID. Just use the -p option. Not only does it save an extra step, but it avoids the inevitable mistakes when a small PID (as in PID=123) will be found in 1123 1234 2123 and so on. It's really important to use all the options available in ps as they are 100% accurate whereas grep will match anything on the ps line.

UNIX95 is a special variable found in most flavors of Unix and is used to signal an alternate behavior in certain processes and libraries. In the case of ps, you will see the term XPG4 for several options (-C -H -o for example) and these options are invlaid if UNIX95 has not been set. But because UNIX95 affects so many other things, it is always recommended to set the value on the command line so it is temporary for the child process. Never type: export UNIX95=something as it can affect things in an odd way. The use of: UNIX95= ps... may look strange but UNIX95= is defining the variable and giving it a null value, which in the shell is very different than having an undefined variable. You can assign any value to UNIX95, as it needs to exist but the contents are irrelevant.
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation