]> git.proxmox.com Git - mirror_qemu.git/commit
cryptodev: Support query-stats QMP command
authorzhenwei pi <pizhenwei@bytedance.com>
Wed, 1 Mar 2023 10:58:46 +0000 (18:58 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 7 Mar 2023 17:38:59 +0000 (12:38 -0500)
commitf2b901098e14ad1aaffab82464917b8679499cc5
treebc79041378dc0f9c4091f0463415ae18bdf9ddf4
parent2580b452ffccfb2bcba97dbfcb0d6067d06bc453
cryptodev: Support query-stats QMP command

Now we can use "query-stats" QMP command to query statistics of
crypto devices. (Originally this was designed to show statistics
by '{"execute": "query-cryptodev"}'. Daniel BerrangĂ© suggested that
querying configuration info by "query-cryptodev", and querying
runtime performance info by "query-stats". This makes sense!)

Example:
~# virsh qemu-monitor-command vm '{"execute": "query-stats", \
   "arguments": {"target": "cryptodev"} }' | jq
{
  "return": [
    {
      "provider": "cryptodev",
      "stats": [
        {
          "name": "asym-verify-bytes",
          "value": 7680
        },
        ...
        {
          "name": "asym-decrypt-ops",
          "value": 32
        },
        {
          "name": "asym-encrypt-ops",
          "value": 48
        }
      ],
      "qom-path": "/objects/cryptodev0" # support asym only
    },
    {
      "provider": "cryptodev",
      "stats": [
        {
          "name": "asym-verify-bytes",
          "value": 0
        },
        ...
        {
          "name": "sym-decrypt-bytes",
          "value": 5376
        },
        ...
      ],
      "qom-path": "/objects/cryptodev1" # support asym/sym
    }
  ],
  "id": "libvirt-422"
}

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-12-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
backends/cryptodev.c
qapi/stats.json
stats/stats-hmp-cmds.c
stats/stats-qmp-cmds.c