|
From: | Martin Pala |
Subject: | Re: total cpu process bug? |
Date: | Wed, 11 Jan 2012 20:01:47 +0100 |
Hi Tom, you're absolutely correct - there was bug in the cpu usage which incorrectly capped the CPU usage to the fraction equivalent to single CPU core. As you mentioned, the problem could occur when monitoring CPU usage of multi-threaded processes on multi-core machines. Thanks for the patch, it will be part of the next release. Best regards, Martin --- monit/trunk/src/process.c (original) +++ monit/trunk/src/process.c Wed Jan 11 19:55:27 2012 @@ -233,8 +233,8 @@ /* The cpu_percent may be set already (for example by HPUX module) */ if (pt[i].cpu_percent == 0 && pt[i].cputime_prev != 0 && pt[i].cputime != 0 && pt[i].cputime > pt[i].cputime_prev) { pt[i].cpu_percent = (int)((1000 * (double)(pt[i].cputime - pt[i].cputime_prev) / (pt[i].time - pt[i].time_prev)) / systeminfo.cpus); - if (pt[i].cpu_percent > 1000 / systeminfo.cpus) - pt[i].cpu_percent = 1000 / systeminfo.cpus; + if (pt[i].cpu_percent > 1000) + pt[i].cpu_percent = 1000; } } else { pt[i].cputime_prev = 0; On Jan 6, 2012, at 9:32 PM, Tom Pepper wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |