Skip to content
Snippets Groups Projects
  • Paolo Bonzini's avatar
    cf7405bc
    qmp: add filtering of statistics by name · cf7405bc
    Paolo Bonzini authored
    
    Allow retrieving only a subset of statistics.  This can be useful
    for example in order to plot a subset of the statistics many times
    a second: KVM publishes ~40 statistics for each vCPU on x86; retrieving
    and serializing all of them would be useless.
    
    Another use will be in HMP in the following patch; implementing the
    filter in the backend is easy enough that it was deemed okay to make
    this a public interface.
    
    Example:
    
    { "execute": "query-stats",
      "arguments": {
        "target": "vcpu",
        "vcpus": [ "/machine/unattached/device[2]",
                   "/machine/unattached/device[4]" ],
        "providers": [
          { "provider": "kvm",
            "names": [ "l1d_flush", "exits" ] } } }
    
    { "return": {
        "vcpus": [
          { "path": "/machine/unattached/device[2]"
            "providers": [
              { "provider": "kvm",
                "stats": [ { "name": "l1d_flush", "value": 41213 },
                           { "name": "exits", "value": 74291 } ] } ] },
          { "path": "/machine/unattached/device[4]"
            "providers": [
              { "provider": "kvm",
                "stats": [ { "name": "l1d_flush", "value": 16132 },
                           { "name": "exits", "value": 57922 } ] } ] } ] } }
    
    Extracted from a patch by Mark Kanda.
    
    Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    cf7405bc
    History
    qmp: add filtering of statistics by name
    Paolo Bonzini authored
    
    Allow retrieving only a subset of statistics.  This can be useful
    for example in order to plot a subset of the statistics many times
    a second: KVM publishes ~40 statistics for each vCPU on x86; retrieving
    and serializing all of them would be useless.
    
    Another use will be in HMP in the following patch; implementing the
    filter in the backend is easy enough that it was deemed okay to make
    this a public interface.
    
    Example:
    
    { "execute": "query-stats",
      "arguments": {
        "target": "vcpu",
        "vcpus": [ "/machine/unattached/device[2]",
                   "/machine/unattached/device[4]" ],
        "providers": [
          { "provider": "kvm",
            "names": [ "l1d_flush", "exits" ] } } }
    
    { "return": {
        "vcpus": [
          { "path": "/machine/unattached/device[2]"
            "providers": [
              { "provider": "kvm",
                "stats": [ { "name": "l1d_flush", "value": 41213 },
                           { "name": "exits", "value": 74291 } ] } ] },
          { "path": "/machine/unattached/device[4]"
            "providers": [
              { "provider": "kvm",
                "stats": [ { "name": "l1d_flush", "value": 16132 },
                           { "name": "exits", "value": 57922 } ] } ] } ] } }
    
    Extracted from a patch by Mark Kanda.
    
    Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
qmp-cmds.c 15.89 KiB