We use cookies to ensure that we give you the best experience on our website. Visit our Privacy Policy to learn more. If you continue to use this site, we will assume that you are okay with it.

Your choices regarding cookies on this site.
Your preferences have been updated.
In order for the changes to take effect completely please clear your browser cookies and cache. Then reload the page.

Werk #6735: cpu_util_unix: Fixed calculation of CPU usage on UNIX

ComponentChecks & Agents
Titlecpu_util_unix: Fixed calculation of CPU usage on UNIX
Date2018-09-27 16:45:27
Checkmk EditionCheckmk Raw Edition (CRE)
Checkmk Version1.4.0p37,1.6.0b1,1.5.0p5
LevelTrivial Change
ClassBug Fix
CompatibilityCompatible - no manual interaction needed

The result of the cpu_usage is wrong. The cpu_time_guest is included in cpu_time_user: See https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/kernel/sched/cputime.c for more information:



/*

* Account guest CPU time to a process.

* @p: the process that the CPU time gets accounted to

* @cputime: the CPU time spent in virtual machine since the last update

*/

void account_guest_time(struct task_struct *p, u64 cputime)

{

u64 *cpustat = kcpustat_this_cpu->cpustat;

/* Add guest time to process. */ p->utime += cputime; account_group_user_time(p, cputime); p->gtime += cputime;

/* Add guest time to cpustat. */ if (task_nice(p) > 0) { cpustat[CPUTIME_NICE] += cputime; cpustat[CPUTIME_GUEST_NICE] += cputime; } else { cpustat[CPUTIME_USER] += cputime; cpustat[CPUTIME_GUEST] += cputime; } }