On Thu, Aug 18, 2022 at 08:47:20AM +0530, Amneesh Singh wrote:
This patch uses qemuMonitorQueryStats to query
"halt_poll_success_ns"
and "halt_poll_fail_ns" for every vCPU. The respective values for each
vCPU are then added together.
Signed-off-by: Amneesh Singh <natto(a)weirdnatto.in>
---
src/qemu/qemu_driver.c | 81 ++++++++++++++++++++++++++++++++++++++----
1 file changed, 75 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 333225dd21..6e2bef26aa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17769,15 +17769,84 @@ qemuDomainGetStatsCpuCgroup(virDomainObj *dom,
return 0;
}
+static int
+qemuDomainGetStatsCpuHaltPollTimeFromStats(virDomainObj *dom,
+ unsigned int privflags,
+ unsigned long long *haltPollSuccess,
+ unsigned long long *haltPollFail)
+{
+ qemuDomainObjPrivate *priv = dom->privateData;
+ qemuMonitorQueryStatsTargetType target = QEMU_MONITOR_QUERY_STATS_TARGET_VCPU;
+ qemuMonitorQueryStatsProvider *provider = NULL;
+ g_autoptr(GPtrArray) providers = NULL;
+ g_autoptr(virJSONValue) queried_stats = NULL;
+ const char *success_str =
qemuMonitorQueryStatsNameTypeToString(QEMU_MONITOR_QUERY_STATS_NAME_HALT_POLL_SUCCESS_NS);
+ const char *fail_str =
qemuMonitorQueryStatsNameTypeToString(QEMU_MONITOR_QUERY_STATS_NAME_HALT_POLL_FAIL_NS);
+ size_t i;
+
I added a reset of the values to 0 here for good measure.
Reviewed-by: Martin Kletzander <mkletzan(a)redhat.com>