[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] confusions on monitoring VM cpu usage inXenhypervisor

1. I want the  CPU usage information like this:

Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

2. From the VM's perspective, I want to make it out what's the sum of busy_time 
and idle_time, 
According to my understanding, I think when a vCPU is scheduled on pCPU,  from 
the perspective of vCPU, its (busy_time +idle_time) equals to 
the percentage of CPU it gets from the hypervisor (because I think when 
scheduled on a pCPU, the scenario is like a physical OS running, contains 
both busy_time and idle_time ), Then how could I know the busy_time of a vCPU 
from VM's perspective, since you have noted that if a vCPU is scheduled on 
pCPU, it keeps 
consuming CPU cycles?

[please, don't drop the list. Re-added]

On lun, 2014-02-24 at 10:30 +0800, Charles wrote:
> Thanks for your reply. 
> 1.The VM usage I mean here is similar to the result of command top in the VM. 
Ok, but still, when running top inside the VM, which part are you
interested in? How busy the various vCPUs are or what (as in what
process/OS component) is actually keeping the busy?

That matters because, how busy they are is something that you, to some
extent, see in Xen, as it is at lest bound to how much he various vCPUs
want to run on the host's pCPUs, and that's the hypervisor's scheduler's

If you want to know what process they're running, at what time that
started, etc., what's the "priority" (inside the VM) then this is
something I don't think you can easily have Xen aware of, unless you
introduce some kind of scheduler paravirtualization.

> 2."use the usage information in Credit" means I want to use the usage 
> information to guess the workload type running in the VM
Still too few info (see above). xentop tells already whether a
particular vCPU is getting, say, 5% of pCPU time. Have something like
that inside Xen should not be that hard.

What it does not (xentop) tell is whether a particular vCPU, despite
getting 5%, is asking for more, and only getting that for whatever
reason. That has to do with the estimation of the system load that I was
mentioning, which is embedded in credit2 right now, but can be

So, which one, if any, of the above are you after?

> To the best of my knowledge, when in physical OS, the CPU may be idle or 
> busy. Then the OS CPU usage can be computed by (busy_time / (idle_time + 
> busy_time))
> If the vCPU is running the on pCPU and it's consuming pCPU cycles all the 
> time, then is it mean  idle_time = 0? then how to I compute the CPU usage?
Err... from Xen's perspective, if a vCPU is always running, then
idle_time=0, then (busy_time/(idle_time+busy_time))=1, which matches
with the concept of being "always running".

I'm sure I'm missing something of what you meant here...


<<This happens because I choose it to happen!>> (Raistlin Majere)
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.