From 467ef823d83ed7ba68cc92e1a23938726b8c4e9d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 26 Apr 2022 14:59:44 +0200 Subject: qmp: add filtering of statistics by target vCPU Introduce a simple filtering of statistics, that allows to retrieve statistics for a subset of the guest vCPUs. This will be used for example by the HMP monitor, in order to retrieve the statistics for the currently selected CPU. Example: { "execute": "query-stats", "arguments": { "target": "vcpu", "vcpus": [ "/machine/unattached/device[2]", "/machine/unattached/device[4]" ] } } Extracted from a patch by Mark Kanda. Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- qapi/stats.json | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'qapi') diff --git a/qapi/stats.json b/qapi/stats.json index df7c4d886c..8c9abb57f1 100644 --- a/qapi/stats.json +++ b/qapi/stats.json @@ -69,16 +69,30 @@ { 'enum': 'StatsTarget', 'data': [ 'vm', 'vcpu' ] } +## +# @StatsVCPUFilter: +# +# @vcpus: list of QOM paths for the desired vCPU objects. +# +# Since: 7.1 +## +{ 'struct': 'StatsVCPUFilter', + 'data': { '*vcpus': [ 'str' ] } } + ## # @StatsFilter: # # The arguments to the query-stats command; specifies a target for which to -# request statistics. +# request statistics and optionally the required subset of information for +# that target: +# - which vCPUs to request statistics for # # Since: 7.1 ## -{ 'struct': 'StatsFilter', - 'data': { 'target': 'StatsTarget' } } +{ 'union': 'StatsFilter', + 'base': { 'target': 'StatsTarget' }, + 'discriminator': 'target', + 'data': { 'vcpu': 'StatsVCPUFilter' } } ## # @StatsValue: -- cgit v1.2.3-55-g7522