From 068cc51d42f771d2a453d628c10e199e7d104edd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 26 Apr 2022 11:49:33 +0200 Subject: qmp: add filtering of statistics by provider Allow retrieving the statistics from a specific provider only. This can be used in the future by HMP commands such as "info sync-profile" or "info profile". The next patch also adds filter-by-provider capabilities to the HMP equivalent of query-stats, "info stats". Example: { "execute": "query-stats", "arguments": { "target": "vm", "providers": [ { "provider": "kvm" } ] } } The QAPI is a bit more verbose than just a list of StatsProvider, so that it can be subsequently extended with filtering of statistics by name. If a provider is specified more than once in the filter, each request will be included separately in the output. Extracted from a patch by Mark Kanda. Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'accel/kvm/kvm-all.c') diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 547de842fd..2e819beaeb 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2644,7 +2644,8 @@ static int kvm_init(MachineState *ms) } if (kvm_check_extension(kvm_state, KVM_CAP_BINARY_STATS_FD)) { - add_stats_callbacks(query_stats_cb, query_stats_schemas_cb); + add_stats_callbacks(STATS_PROVIDER_KVM, query_stats_cb, + query_stats_schemas_cb); } return 0; -- cgit 1.4.1