From: Josh Triplett Subject: [PATCH] Fix domain CPU time calculation to count all VCPU times correctly Date: Mon, 08 Aug 2005 11:22:44 -0700 Message-ID: <1123525364.2881.13.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-i/aNLE+znCmBzMe5iYEs" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=-i/aNLE+znCmBzMe5iYEs Content-Type: text/plain Content-Transfer-Encoding: 7bit Currently, the getdomaininfo function (used to fill in a dom0_getdomaininfo_t for a domain) calculates a domain's total CPU time from its VCPU times using the code: if ( v->cpu_time > cpu_time ) cpu_time += v->cpu_time; This causes a VCPU's time to only be counted if it is greater than the current total; so if VCPU0 has 10 seconds and VCPU1 has 5, the total will be 10, but if VCPU0 has 5 and VCPU10 has 10, the total will be 15. Is there a reason for this behavior? It seems more useful and intuitive to always total the VCPU times to obtain the CPU time. The attached patch removes the conditional, so that all VCPU times for a domain are always totaled to obtain the CPU time for that domain. Signed-off-by: Josh Triplett - Josh Triplett --=-i/aNLE+znCmBzMe5iYEs Content-Disposition: attachment; filename=domain-cpu-time-fix.patch Content-Type: text/x-patch; name=domain-cpu-time-fix.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit diff -r 69b7c9c3a9fd xen/common/dom0_ops.c --- a/xen/common/dom0_ops.c Fri Aug 5 15:11:46 2005 +++ b/xen/common/dom0_ops.c Mon Aug 8 10:45:19 2005 @@ -70,8 +70,7 @@ flags &= ~DOMFLAGS_BLOCKED; if ( v->vcpu_flags & VCPUF_running ) flags |= DOMFLAGS_RUNNING; - if ( v->cpu_time > cpu_time ) - cpu_time += v->cpu_time; + cpu_time += v->cpu_time; vcpu_count++; } --=-i/aNLE+znCmBzMe5iYEs Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-i/aNLE+znCmBzMe5iYEs--