[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] CPU Utilization
On Mon, 12 Dec 2005, Anthony Liguori wrote: > top isn't smart enough to realize that for a portion of the running > time, a domain has been pre-empted out and is not running. > > top will then charge whatever was running at pre-emption time for the > time that other domain running. Actually, the kernel does this charging of time to the wrong entity. I am working on a patch to account the preempted time as "cpu steal" time (like s390 Linux does). Here is the (really simple) hypervisor bit of the patch. The kernel bits need some more work ;) Index: xen-3.0/xen/common/domain.c =================================================================== --- xen-3.0.orig/xen/common/domain.c +++ xen-3.0/xen/common/domain.c @@ -431,8 +431,25 @@ long do_vcpu_op(int cmd, int vcpuid, voi case VCPUOP_is_up: rc = !test_bit(_VCPUF_down, &v->vcpu_flags); break; + + case VCPUOP_cpu_time: + { + dom0_getvcpuinfo_t vi; + vi.online = !test_bit(_VCPUF_down, &v->vcpu_flags); + vi.blocked = test_bit(_VCPUF_blocked, &v->vcpu_flags); + vi.running = test_bit(_VCPUF_running, &v->vcpu_flags); + vi.cpu_time = v->cpu_time; + vi.cpu = v->processor; + vi.cpumap = v->cpumap; + rc = 0; + + if ( copy_to_user(arg, &vi, sizeof(dom0_getvcpuinfo_t)) ) + rc = -EFAULT; + break; + } } + return rc; } Index: xen-3.0/xen/include/public/vcpu.h =================================================================== --- xen-3.0.orig/xen/include/public/vcpu.h +++ xen-3.0/xen/include/public/vcpu.h @@ -51,6 +51,14 @@ /* Returns 1 if the given VCPU is up. */ #define VCPUOP_is_up 3 +/* + * Get information on how much CPU time this VCPU has used, etc... + * + * @extra_arg == pointer to an empty dom0_getvcpuinfo_t, the "OUT" variables + * of which filled in with scheduler info. + */ +#define VCPUOP_cpu_time 4 + #endif /* __XEN_PUBLIC_VCPU_H__ */ /* _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |