1

When I execute topas for a certain process, in the CPU% column it shows me 43% and jumping to 85%.

When I execute:

"ps aux | grep processName"  

The same process is at 5%.

What is more accurate? I also made a loop that similar to the Linux "watch" command, and I see it's at %5.

What's the difference between topas and ps, and who is right?

Output of ps:

[ttfai231:root]/root>ps aux | head -1; ps aux | sort -rn +2 | head -10
USER          PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND
root      9306548  8.6  1.0 12880 12880      - A    13:35:33 41:20 MYDAEMON
root      1048868  2.0  0.0  448  448      - A    13:22:36 11:50 wait

Topas: enter image description here

0

1 Answer 1

1

I believe this is a difference in how each field is computed. For the topas field:

% CPU Utilization

The average processor use of the process over the monitoring interval. The first time a process is shown, this value is the average processor use over the lifetime of the process.

... while the ps field:

%CPU

(u and v flags) The percentage of time the process has used the CPU since the process started. This value is computed by dividing the time the process uses the CPU by the elapsed time of the process. In a multi-processor environment, the value is further divided by the number of available CPUs because several threads in the same process can run on different CPUs at the same time. (Because the time base over which this data is computed varies, the sum of all %CPU fields can exceed 100%.)

I've bolded the pieces of the description that highlight the difference.

The topas CPU% value will fluctuate as the processes uses more or less CPU time, so it will show the CPU usage over the most recent (presumably short) interval; the ps %CPU value will always be shown as the average over the lifetime of the process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .