1834149 Members
2329 Online
110064 Solutions
New Discussion

Re: percent CPU

 
SOLVED
Go to solution
sys-sbd
Advisor

percent CPU

Hi,
How can I report %cpu from only one process during
for example 1 week ?
It's on HPUX11.11 platform .
Thx
8 REPLIES 8
Hein van den Heuvel
Honored Contributor

Re: percent CPU


Is that single process going to run all week, or is the image being recreated multiple times.

Anyway, for such long runtimes I believe it will be more interesting to know how many procent of 1 cpu it used all week, then the percentage of the used cpu time.

Either way. Start with the total cpu time used divided by the total elapsed time (7 * 24 * 60 ?). by the number of cpus, if you want the results expressed in 'system' performance terms.

If you want percentage of the total cpu used instead of actual usage, re-proportion based on some overall cpu% busy count, from sar or uptime.

fwiw,
Hein.
RAC_1
Honored Contributor

Re: percent CPU

It is easy if you have GLANCE installed. you define your process in /var/opt/perf/param file. It looks something like this.

application = "your_process"
file = *abc*

Assuming that the process name is abcdx. Once you do changes, recycle scopeux (mwa restart scope) and it would monitor the resources used by this process.

If you have perfview installed, it can save the historical data.

If you do not have glance, you can folloing cron entry to run at pre-defined interval and log the details to a file. you then can prepare a graph from it.

* * * * * UNIX95= ps -C "process_name" -o "pid, args, pcpu" >> /tmp/process.txt

This would monitor the process every minute and put the % cpu used in /tmp/process.txt file.

Anil
There is no substitute to HARDWORK
Paul_481
Respected Contributor

Re: percent CPU

Hi,

If you want to record the cpu for a particular process and you do not have any tools, I suggest you create a script that is run in a cron to capture the cpu of the process and store the result in a file.

ps -ef|grep | awk '{print $4} >> fn

You can then cron this to an interval of your choice.


Paul
sys-sbd
Advisor

Re: percent CPU

Well in fact I can't give the name of the process( it had lots of processes with the same name ) is it possible to retrieve the % of CPU just with the pid as the command UNIX95= ps -C "process_name" -o "pid, args, pcpu"?
Geoff Wild
Honored Contributor
Solution

Re: percent CPU

I had to do Anil's way like so for example on httpd:

UNIX95= ps -C httpd -o pid,args=Command-Line -o pcpu

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: percent CPU

By pid:

UNIX95= ps -p 1302 -o pid,args=Command-Line -o pcpu

Rgds..Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
sys-sbd
Advisor

Re: percent CPU

thx Geoff, it's working well.
Could you please where can I find more info about the command you give me ?
Geoff Wild
Honored Contributor

Re: percent CPU

Sure:

man ps

Also a quick google will reveal a lot, like:

http://www.interex.org/pubcontent/enterprise/jan00/07uxqa.html

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.