[libvirt-users] What's the precision of the domain cpu stats?

Zhihua Che zhihua.che at gmail.com
Mon Apr 16 08:33:51 UTC 2012


Hi, everyone
        I'm using libvirt and resort to virDomainGetCPUStats for cpu
usage by one domain. In my system, Ubuntu-11.10 64bit with 2 cores and
Qemu Hyperviser, this function returns something like this:
        virTypedParameter[0]
       {
           field: "cpu_time"
           type: 4
           value.ul  51640610899
       }
       virTypedParameter[1]
       {
           field: "cpu_time"
           type: 4
           value.ul  55302820304
       }

      This 51640610899 and 55302820304  kind of conflict the result
returned by "cat /proc/stat | grep cpu"
cpu  449224 6812 89433 4407261 50327 1 2443 0 13041 0
cpu0 224251 2603 43144 2195672 34682 0 2350 0 6692 0
cpu1 224972 4209 46289 2211589 15644 0 93 0 6349 0

I know the precision of /proc/stat is 1/HZ,  so what's the precision
of CPU stats returned by virDomainGetCPUStats?




More information about the libvirt-users mailing list