The percentCPU of the process plugin is computed from a series of variables within the code. The values are taken from the "/proc/<pid>/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, divides by the number of seconds between samples. An adjustment happens for the number of logical CPUs.
The values used in the calculation can be seen by enabling debug: For GW2 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:
<pid> [<jiffies> - <jiffies last sample> = <jiffies used this sample>] [<time> - <last sample time> = <time since last sample>] <cpu usage> <args>
Please sign in to leave a comment.