[libvirt-users] What does cpu_time returned by virDomainGetCPUStats mean?

Zhihua Che zhihua.che at gmail.com
Mon Apr 16 11:37:24 UTC 2012


hi, everyone.

    I find an 'interesting' thing involving virDomainGetCPUStats(). I
call it for cpu usage consumed by a domain and get a array of
virTypedParameter. My system is 2-core and hyperviser return 1
parameter per cpu. So the contents of the array is like this.
    virTypedParameter[0]
    {
        .fiedl = "cpu_time"
        .type = 4
        .value.ul = 51640610899
    }
    virTypedParameter[1]
    {
        .field = "cpu_time"
        .type = 4
        .value.ul = 55302820304
    }

   I thought this value store the run time of the cpu since last boot.
But I find I was wrong because this value would increase until it
wraps down and doesn't reset even the domain is restarted.

   So, what does this value mean?

   How can I get the CPU usage of the domain?

   I found nothing on the API reference doc page:-(. No word is
related with the meaning of the returned array of virTypedParameter by
virDomainGetCPUStats().




More information about the libvirt-users mailing list