How is CPU usage calculated by processes probe for different operating systems
Release: Any supported UIM release
Component: processes probe
%cpu in ps command is calculated differently by the processes probe for different operating systems:
Linux- CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage
HPUX- The percentage of CPU time used by this process during the last scheduling interval.
Free BSD- The CPU utilization of the process; this is a decaying average over up to a minute of previous (real) time. Since the time base over which this is computed varies (since processes may be very young) it is possible for the sum of all %cpu fields to exceed 100%.
AIX- 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%.)
From monitoring perspective, %CPU should depict current CPU usage and not the total of when process was started.
Keeping in mind the vast difference in calculation of %cpu among different OS’s, the process Probe calculates %cpu (rather than pick %cpu from ps command) as follows:
%CPU= ((Delta of CPU used by process) * 100)/((Delta of Total Time of Process)* Number of processor)
where delta is difference between current and last sample.
This is essentially the same as process probe computes %cpu except for one difference: in "ps" command the value of processor and CPU time is the time since the process started whereas in the process probe the processor and CPU time is delta of last and current sample.
So %CPU reported by OS and %CPU reported by processes probe can differ. For example...
%CPU (Process probe) = %CPU(ps command for Linux)/Number of processor
So, when Linux shows 75%. Process probe will show 75/Number of Processor value.
Probe fetch values from performance counter for the respective process
To compute the proceses's CPU_usage probe uses below "performance counter"
Counter -> " Process ===>"% Processor Time" . It is further computed based on multiple sample value configured in probe.
For example if you want to fetch value for idle process you can get it from performance monitor tool (see as below)