mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 03:21:19 +00:00
qemu: Introduce qemuDomainGetStatsCpuHaltPollTime
This function add halt polling time interface in domstats. So that we can use command 'virsh domstats VM' to get the data if system support. Signed-off-by: Yang Fei <yangfei85@huawei.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a90b1f24cf
commit
f513297bd4
@ -2260,6 +2260,10 @@ When selecting the *--state* group the following fields are returned:
|
|||||||
* ``cpu.time`` - total cpu time spent for this domain in nanoseconds
|
* ``cpu.time`` - total cpu time spent for this domain in nanoseconds
|
||||||
* ``cpu.user`` - user cpu time spent in nanoseconds
|
* ``cpu.user`` - user cpu time spent in nanoseconds
|
||||||
* ``cpu.system`` - system cpu time spent in nanoseconds
|
* ``cpu.system`` - system cpu time spent in nanoseconds
|
||||||
|
* ``cpu.haltpoll.success.time`` - cpu halt polling success time spent in
|
||||||
|
nanoseconds
|
||||||
|
* ``cpu.haltpoll.fail.time`` - cpu halt polling fail time spent in
|
||||||
|
nanoseconds
|
||||||
* ``cpu.cache.monitor.count`` - the number of cache monitors for this
|
* ``cpu.cache.monitor.count`` - the number of cache monitors for this
|
||||||
domain
|
domain
|
||||||
* ``cpu.cache.monitor.<num>.name`` - the name of cache monitor <num>
|
* ``cpu.cache.monitor.<num>.name`` - the name of cache monitor <num>
|
||||||
|
@ -11625,6 +11625,13 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
|
|||||||
* "cpu.user" - user cpu time spent in nanoseconds as unsigned long long.
|
* "cpu.user" - user cpu time spent in nanoseconds as unsigned long long.
|
||||||
* "cpu.system" - system cpu time spent in nanoseconds as unsigned long
|
* "cpu.system" - system cpu time spent in nanoseconds as unsigned long
|
||||||
* long.
|
* long.
|
||||||
|
* "cpu.haltpoll.success.time" - halt-polling cpu usage about the VCPU polled
|
||||||
|
* until a virtual interrupt was delivered in
|
||||||
|
* nanoseconds as unsigned long long.
|
||||||
|
* "cpu.haltpoll.fail.time" - halt-polling cpu usage about the VCPU had to schedule
|
||||||
|
* out (either because the maximum poll time was reached
|
||||||
|
* or it needed to yield the CPU) in nanoseconds as
|
||||||
|
* unsigned long long.
|
||||||
* "cpu.cache.monitor.count" - the number of cache monitors for this domain
|
* "cpu.cache.monitor.count" - the number of cache monitors for this domain
|
||||||
* "cpu.cache.monitor.<num>.name" - the name of cache monitor <num>
|
* "cpu.cache.monitor.<num>.name" - the name of cache monitor <num>
|
||||||
* "cpu.cache.monitor.<num>.vcpus" - vcpu list of cache monitor <num>
|
* "cpu.cache.monitor.<num>.vcpus" - vcpu list of cache monitor <num>
|
||||||
|
@ -17857,6 +17857,23 @@ qemuDomainGetStatsCpuCgroup(virDomainObj *dom,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainGetStatsCpuHaltPollTime(virDomainObj *dom,
|
||||||
|
virTypedParamList *params)
|
||||||
|
{
|
||||||
|
unsigned long long haltPollSuccess = 0;
|
||||||
|
unsigned long long haltPollFail = 0;
|
||||||
|
pid_t pid = dom->pid;
|
||||||
|
|
||||||
|
if (virHostCPUGetHaltPollTime(pid, &haltPollSuccess, &haltPollFail) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (virTypedParamListAddULLong(params, haltPollSuccess, "cpu.haltpoll.success.time") < 0 ||
|
||||||
|
virTypedParamListAddULLong(params, haltPollFail, "cpu.haltpoll.fail.time") < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainGetStatsCpu(virQEMUDriver *driver,
|
qemuDomainGetStatsCpu(virQEMUDriver *driver,
|
||||||
@ -17870,6 +17887,9 @@ qemuDomainGetStatsCpu(virQEMUDriver *driver,
|
|||||||
if (qemuDomainGetStatsCpuCache(driver, dom, params) < 0)
|
if (qemuDomainGetStatsCpuCache(driver, dom, params) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (qemuDomainGetStatsCpuHaltPollTime(dom, params) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user