Josh Triplett
2005-Aug-08 18:22 UTC
[Xen-devel] [PATCH] Fix domain CPU time calculation to count all VCPU times correctly
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 <josht@us.ibm.com> - Josh Triplett _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Aug-08 18:37 UTC
Re: [Xen-devel] [PATCH] Fix domain CPU time calculation to count all VCPU times correctly
On 8 Aug 2005, at 19:22, Josh Triplett wrote:> 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.I think we used to return the highest VCPU time as domain time. Someone decided to instead sum across all VCPU times, but I guess forgot to remove the conditional. :-) -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel