Back to Geneos FAQ

How does the process plugin compute the percent CPU in Linux?

The percentCPU of the process plugin is computed from a series of variables within the code. The values are taken from the “/proc//stat” file (in Linux); it is used to get the number of jiffies used since the process started. It takes the utime and adds it to the stime. It takes the difference between the last sample and this sample, then divides by the number of seconds between samples. An adjustment happens for the number of logical CPUs.

Additional Notes

value will be reported as 0. - The fields in the /proc//stat file can

be seen by doing ‘man proc’. - The data is shared between multiple instances of

the sampler on the same probe - running multiple

at very fast sample rates will hit the ‘more than

three jiffies needed’ limit.

The values used in the calculation can be seen by enabling debug: This is set in the probe debug ‘Debug’ section where the Module is processes, and setting is *

The debug output looks like this:

DEBUG: *:pcpu Proc: 12864 [210 - 187 = 23] [1217495784 - 1217495764 = 20] 1.150000 /home/example/example -foo bar

The fields are:

[ - = ] [

["Geneos"] ["FAQ"]

Was this topic helpful?