PS command capturing CPU
I want to capture the cpu utilization of a process.
so I write a small script using this command ps -o pid,pcpu <PID> it does give me the cpu util for that pid however the number is different from TOP (irix on). the number from TOP is more accurate. since I have dual core cpu , how can I make the "ps" command works ? thanks |
don't use irix but try
Code:
ps aux |
Quote:
The number from "top" is a different metric to that presented by "ps". Neither is necessarily more accurate than the other, given that /proc is the source of the data used by both. Read the man pages, then decide what it really is you are trying to measure. |
the program that I am tracking is a single threaded program. does that mean pcpu is more accurate ?
I do have quad dual core CPU (4 @dual core). I read somewhere that pcpu is for the whole machine ie a CPU hog(100%) on a 4 CPU machine would register as 25%. Is this correct? So why then in my case , pcpu gives 75% and top irix on gives 25%? What I want is a total CPU percentage.just like the description of pcpu I found on the net Could you please help me understand ? btw is there a command or switch to turn on irix mode in top if I want to use batch? thanks |
All times are GMT -5. The time now is 04:35 AM. |