You calculate is vCPU use time not utilization。use_time/total_cpu_time is utilization。total_cpu_time=`cat /proc/stat |sed -n '1p'|awk '{ print sum=$2+$3+$4+$5+$6+$7+$8+$9+$10}'`------------------ 原始邮件 ------------------发件人: "changqian zuo";<zuochangqian@gmail.com>;发送时间: 2015年7月24日(星期五) 中午1:51收件人: "libvirt-users"<libvirt-users@redhat.com>;主题: [libvirt-users] virsh dominfo does not show correct cpuTimeHi,I am doing some domain resource monitoring work. I usecat /dev/urandom | md5sumto simulate vCPU load and write a script to calculate vCPU utilization. It seems all good at the beginning. After I abort the ``cat ... md5sum`` command in domain, I see some strange data as below:CPU time: 8410960000000CPU util: 99.8410609331%CPU time: 8411970000000CPU util: 100.843672381%CPU time: 8412380000000CPU util: 40.9336949531%CPU time: 8412440000000CPU util: 5.9899303915%CPU time: 8412440000000CPU util: 0.0%CPU time: 8412490000000CPU util: 4.99165856007%CPU time: 8412490000000CPU util: 0.0%CPU time: 8412490000000CPU util: 0.0%CPU time: 8412570000000CPU util: 7.987195515%CPU time: 8412570000000CPU util: 0.0%CPU time: 8412590000000CPU util: 1.99668576091%CPU time: 8412670000000CPU util: 7.98700539474%CPU time: 8412720000000CPU util: 4.99167281754%CPU time: 8412780000000CPU util: 5.98888552548%Looking at those 0.0% lines. Strange, though the guest is running, cpuTime does not increase. How can this happen? Any one helps? Thanks.Host information:- CentOS Linux release 7.0.1406 (Core)- libvirt 1.2.8- qemu-kvm-rhev 2.1.2----- python script to capture cpu domain usage ----import libvirtimport timeconn = libvirt.openReadOnly("qemu:///system")dom = conn.lookupByName('cpu-test')last_time = time.time()last_cpu_time = dom.info()[4]while True:time.sleep(1)this_time = time.time()dom_info = dom.info()print "CPU time: %s" % dom_info[4]print "CPU util: %s%%" % ((dom_info[4] - last_cpu_time) / ((this_time - last_time) * 10000000))last_cpu_time = dom_info[4]last_time = this_time----------------------------- end -----------------------------