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/
Additional Notes
- If less than three jiffies have been used, then the
value will be reported as 0. - The fields in the /proc/
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: