1832906 Members
2785 Online
110048 Solutions
New Discussion

Re: Pocess tracking

 
Roberto Volsa
Frequent Advisor

Pocess tracking

Dear all,
I would like to track the CPU occupation from a single process, something like top output in the time.
PerfView shows only global CPU utilization versus time, not single process occupation; instead GlancePlus shows only instant CPU occupation for processes but doesn't save data!
Thus, how to get CPU occupation form a process versus time?
Thanx in advance
Roberto
7 REPLIES 7
Stefan Farrelly
Honored Contributor

Re: Pocess tracking


The accurate way to measure this is to use another HP product called PerfView along with MeasureWare which logs all data to files then you can graph the results over any period of time. It has a massive amount of detail.

If you want to use top though simply do something like;

top -d >/tmp/

Then when its finished to;

strings /tmp/ | grep

This will show results like;

[5C41:33 0.16 0.16 midaemon
[5C41:33 0.13 0.12 midaemon
[5C41:33 0.15 0.15 midaemon
[5C41:33 0.16 0.16 midaemon
[5C41:33 0.13 0.13 midaemon

Ignore the leftovers of control characters at the start of each line, but you can see the cpu percentages for the midaemon process and you can then pipe them into a script to total if needed.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Robin Wakefield
Honored Contributor

Re: Pocess tracking

Hi

You can use the hidden -f switch of top:

# top -d 3 -f /tmp/fred99
# grep top /tmp/fred99
q9 20922 root 178 20 352K 192K run 0:00 1.03 0.23 top
q9 20922 root 178 20 352K 324K run 0:00 0.75 0.30 top
q9 20922 root 178 20 352K 324K run 0:00 0.59 0.31 top

Obviously you can then format this to suit.

Rgds, Robin.
Alex Green
Frequent Advisor

Re: Pocess tracking

Hi,

Please do not hold me to this, but I am faily sure that "sar" should allow you to monitor and log the CPU usage into a text file that can then be used with something like xplot or the like.

Hope this helps.....
"The physicist's greatest tool is his wastebasket." - Albert Einstein.
Roberto Volsa
Frequent Advisor

Re: Pocess tracking

Stefan,
PerfView is installed, but it shows only global CPU utilization, not CPU per process.
Do you know how to get per process utilization?
Thanx
Roberto
Alex Green
Frequent Advisor

Re: Pocess tracking

I believe with sar, the following should do this.

If the cpu command in HP.config is the following:

#
id=cpu
command=/usr/sbin/sar -M 3 | cut -b9-80
wait=4
idle=5
startLine=5
cpu=1
#

This will result in the sar output to look like the following:


r-mag B.11.00 A 9000/869 08/15/01
cpu %usr %sys %wio %idle
0 44 12 2 42
1 87 10 0 2
2 94 2 0 3
3 100 0 0 0
system 81 6 1 12

"The physicist's greatest tool is his wastebasket." - Albert Einstein.
Alex Green
Frequent Advisor

Re: Pocess tracking

Apologies... notes I had were for SiteScope, please ignore my previous post.

Thnx
"The physicist's greatest tool is his wastebasket." - Albert Einstein.
Thom Cornwell
Frequent Advisor

Re: Pocess tracking

Open up PerfView - Select a scope and metric - draw a graph - Go to Show in the headers of the graph - then drill down [ select Drill to: process ] and you should see the information you are looking for. Unfortunately this cannot be run from the command line.