]> xenbits.xensource.com Git - libvirt.git/commit
qemu: add reporting of vCPU wait time
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 10 Dec 2015 14:37:01 +0000 (14:37 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 26 Jan 2016 14:34:23 +0000 (14:34 +0000)
commit511e7c5bbaed475bd68982a6926834e27ee3841a
tree015b1ecde0eda775988b702516c9758bdca48067
parent985f01a65fb84951bccee27ecf09860d3b7961ea
qemu: add reporting of vCPU wait time

The VIR_DOMAIN_STATS_VCPU flag to virDomainListGetStats
enables reporting of stats about vCPUs. Currently we
only report the cumulative CPU running time and the
execution state.

This adds reporting of the wait time - time the vCPU
wants to run, but the host scheduler has something else
running ahead of it.

The data is reported per-vCPU eg

$ virsh domstats --vcpu demo
 Domain: 'demo'
   vcpu.current=4
   vcpu.maximum=4
   vcpu.0.state=1
   vcpu.0.time=1420000000
   vcpu.0.wait=18403928
   vcpu.1.state=1
   vcpu.1.time=130000000
   vcpu.1.wait=10612111
   vcpu.2.state=1
   vcpu.2.time=110000000
   vcpu.2.wait=12759501
   vcpu.3.state=1
   vcpu.3.time=90000000
   vcpu.3.wait=21825087

In implementing this I notice our reporting of CPU execute
time has very poor granularity, since we are getting it
from /proc/$PID/stat. As a future enhancement we should
prefer to get CPU execute time from /proc/$PID/schedstat
or /proc/$PID/sched (if either exist on the running kernel)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_driver.c