[libvirt-users] [API reference] confused by CPU time term

Hi, everyone I'm writing a virtual machine monitor based on libvirt. As I read the api reference, I found I'm confused by some terms. 1, What is cumulative I/O wait CPU time? API reference says that VIR_NODE_CPU_STATS_IOWAIT indicate cumulative I/O wait CPU time. I'm confused by this time. As far as I know, when cpu meets IO wait situation, it will schedule another task, so, how this IO wait time is accounted? 2, How do I get VCPU runtime? In my mind, VIR_DOMAIN_CPU_STATS_CPUTIME indicates the physical cpu time consumed by the domain. Is there any API by which I can query virtual CPU running stats in one domain?

On 03/28/2012 01:44 PM, Zhihua Che wrote:
Hi, everyone I'm writing a virtual machine monitor based on libvirt. As I read the api reference, I found I'm confused by some terms.
1, What is cumulative I/O wait CPU time? API reference says that VIR_NODE_CPU_STATS_IOWAIT indicate cumulative I/O wait CPU time. I'm confused by this time. As far as I know, when cpu meets IO wait situation, it will schedule another task, so, how this IO wait time is accounted?
It's from /proc/stat, see man proc (/proc/stat).
2, How do I get VCPU runtime? In my mind, VIR_DOMAIN_CPU_STATS_CPUTIME indicates the physical cpu time consumed by the domain. Is there any API by which I can query virtual CPU running stats in one domain?
See virDomainGetVcpus, though it doesn't returns the usertime and systime seperately, only cputime (usertime + systime) for each vCPU thread. Regards, Osier

在 2012年3月28日 下午5:02,Osier Yang <jyang@redhat.com> 写道:
On 03/28/2012 01:44 PM, Zhihua Che wrote:
Hi, everyone I'm writing a virtual machine monitor based on libvirt. As I read the api reference, I found I'm confused by some terms.
1, What is cumulative I/O wait CPU time? API reference says that VIR_NODE_CPU_STATS_IOWAIT indicate cumulative I/O wait CPU time. I'm confused by this time. As far as I know, when cpu meets IO wait situation, it will schedule another task, so, how this IO wait time is accounted?
It's from /proc/stat, see man proc (/proc/stat).
2, How do I get VCPU runtime? In my mind, VIR_DOMAIN_CPU_STATS_CPUTIME indicates the physical cpu time consumed by the domain. Is there any API by which I can query virtual CPU running stats in one domain?
See virDomainGetVcpus, though it doesn't returns the usertime and systime seperately, only cputime (usertime + systime) for each vCPU thread.
Regards, Osier
I guess I miss some important points. I find that the cpu_time returned by virDomainGetCPUStats is always increasing despite it's restarted. Precisely, after calling virDomainGetCPUStats, it return a array of virTypedParameter, each element for each cpu. one example is { .fiedl = "cpu_time", .type = 4, .value.ul = 7744142223 } I guess this value is cumulative running time of the domain since it's created? Is that right?

On 04/16/2012 04:02 AM, Zhihua Che wrote:
I find that the cpu_time returned by virDomainGetCPUStats is always increasing despite it's restarted.
That is the time attributed to a single domain. Are you saying that the value doesn't restart at 0 every time you stop and then restart the domain? That would be a problem, because my understanding is that each new qemu process should start over at 0, because we should be (re-)creating a new cgroup subdirectory for each new qemu process.
Precisely, after calling virDomainGetCPUStats, it return a array of virTypedParameter, each element for each cpu. one example is { .fiedl = "cpu_time", .type = 4, .value.ul = 7744142223 }
I guess this value is cumulative running time of the domain since it's created? Is that right?
Yes, virDomainGetCPUStats is documented as returning the cumulative time attributed to the running of this particular domain from the perspective of the current host. At present, migration or managedsave would reset these counts to 0 (as migration starts a new qemu process); perhaps we need to consider enhancing the domain XML associated with live domains in order to transfer cumulative run-time across migration scenarios? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Osier Yang
-
Zhihua Che