Re: CPU Utilized (517 Views)
Posts: 30
Registered: ‎07-17-2011
Message 1 of 10 (568 Views)

# CPU Utilized

Hi,

How can i know the percentage of CPU utilized by such process or by user, for example the percentage for all the root user process.

Thanks

Acclaimed Contributor
Posts: 25,746
Registered: ‎03-06-2006
Message 2 of 10 (559 Views)

# Re: CPU Utilization

[ Edited ]

top will give the percentage for each process.  For a user, you would have to add them up.

Posts: 663
Registered: ‎05-20-2007
Message 3 of 10 (557 Views)

# Re: CPU Utilized

Hi,

ok, but I want to know the percentage of specific process on total CPU number, not on one CPU.

"For a user, you would have to add them up."  do you mean

# top root     =========> but i don't see any output related to root user

Thanks

Acclaimed Contributor
Posts: 25,746
Registered: ‎03-06-2006
Message 4 of 10 (555 Views)

# Re: CPU Utilization

[ Edited ]

>I want to know the percentage of specific process on total CPU number, not on one CPU.

Then you just divide by the total number of CPUs.

>top root  => but I don't see any output related to root user

You would need to add up all of the processes owned by root.  Using ps(1) may be easier:

UNIX95=EXTENDED_PS ps -u root -opid= -ouser= -opcpu= -ocomm=

Posts: 663
Registered: ‎05-20-2007
Message 5 of 10 (553 Views)

# Re: CPU Utilized

Hi,

thanks for your suppor, but What is the third line ?

# UNIX95=EXTENDED_PS ps -u elink -opid= -ouser= -opcpu= -ocomm=

< Then you just divide by the total number of CPUs > can you give me example

Thanks

Acclaimed Contributor
Posts: 25,746
Registered: ‎03-06-2006
Message 6 of 10 (550 Views)

# Re: CPU Utilization

[ Edited ]

>What is the third line?
> UNIX95=EXTENDED_PS ps -u elink -opid= -ouser= -opcpu= -ocomm=

The third column is the percentage CPU time.

>Then you just divide by the total number of CPUs. Can you give me example:

UNIX95=EXTENDED_PS ps -u elink -opid= -ouser= -opcpu= -ocomm= |

awk -v cpus=\$NUM -v user=elink '

{

cpu_percentage += \$3

}

END { print "Total machine usage for", user ":", cpu_percentage / cpus; }'

Where \$NUM is the number of CPUs on your machine.

Posts: 663
Registered: ‎05-20-2007
Message 7 of 10 (534 Views)

# Re: CPU Utilized

Hi,

thanks for your support, but i have the last quetions

how to get sar output of CPU utlization for 1 day and save it to file.

Thanks

Acclaimed Contributor
Posts: 25,746
Registered: ‎03-06-2006
Message 8 of 10 (531 Views)

# Re: CPU Utilization

[ Edited ]

>how to get sar output of CPU utilization for 1 day and save it to file.

Take a look at sar(1m), sadc(1m), sa1(1m) and sa2(1m).

Posts: 52
Registered: ‎08-04-2011
Message 9 of 10 (530 Views)

# Re: CPU Utilized

you can use following hpux utilities to get CPU Utilized.

1. top

2. sar

3. glance

Basant Sharma
Valued Contributor
Posts: 169
Registered: ‎06-16-2011
Message 10 of 10 (517 Views)

# Re: CPU Utilized

Hi

UNIX95= ps -e -o "pcpu args" |sort -r | head -20

sample output

# UNIX95= ps -e -o "pcpu args" |sort -r | head -20
1.27 vxfsd
0.37 /opt/OV/bin/ovcd
0.32 /opt/wbem/lbin/cimprovagt 17 15 HPUXIOTreeIndicationProviderModule
0.23 /opt/hpservices/jre/opt/java1.4/jre/bin/IA64N/java -Xmx512m -DRunnerValuePairFile=/var/opt/runner/data/valuePairs -cp /opt/runn
0.20 vxsvc -r /opt/VRTSob/config/Registry -e
0.20 /opt/wbem/lbin/cimprovagt 13 11 SFMProviderModule
0.20 /opt/OV/lbin/eaagt/opcmsga
0.18 /opt/OV/lbin/conf/ovconfd
.

.

Thanks

____________________________________________
:: Really appreciate if you could assign some points.
:: Don't know how to assign point? Click the KUDOS! star!
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.