Paolo Bonzini <pbonz...@redhat.com> writes: > 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]" ] } }
What heartless people put these poor vCPUs in the orphanage? > > Extracted from a patch by Mark Kanda. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> [...] > diff --git a/qapi/stats.json b/qapi/stats.json > index bcc897258a..26ee69588f 100644 > --- a/qapi/stats.json > +++ b/qapi/stats.json > @@ -65,6 +65,16 @@ > { 'enum': 'StatsTarget', > 'data': [ 'vm', 'vcpu' ] } > > +## > +# @StatsVCPUFilter: > +# > +# @vcpus: list of qom paths for the desired vCPU objects. "QOM paths", because that's how we spell it elsewhere. > +# > +# Since: 7.1 > +## > +{ 'struct': 'StatsVCPUFilter', > + 'data': { '*vcpus': [ 'str' ] } } > + > ## > # @StatsFilter: > # > @@ -73,8 +83,10 @@ > # > # Since: 7.1 > ## > -{ 'struct': 'StatsFilter', > - 'data': { 'target': 'StatsTarget' } } > +{ 'union': 'StatsFilter', > + 'base': { 'target': 'StatsTarget' }, > + 'discriminator': 'target', > + 'data': { 'vcpu': 'StatsVCPUFilter' } } > > ## > # @StatsValue: