]> git.proxmox.com Git - mirror_qemu.git/commitdiff
monitor: add support for boolean statistics
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2022 12:08:09 +0000 (14:08 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 18 Jul 2022 16:51:17 +0000 (18:51 +0200)
The next version of Linux will introduce boolean statistics, which
can only have 0 or 1 values.  Support them in the schema and in
the HMP command.

Suggested-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
monitor/hmp-cmds.c
qapi/stats.json

index ca98df04952bc4cee24b6da235cb1c0d21320872..e8d6963722d493d73b81fb685272d0a3ef9a8406 100644 (file)
@@ -2337,6 +2337,8 @@ static void print_stats_results(Monitor *mon, StatsTarget target,
 
         if (stats_value->type == QTYPE_QNUM) {
             monitor_printf(mon, ": %" PRId64 "\n", stats_value->u.scalar);
+        } else if (stats_value->type == QTYPE_QBOOL) {
+            monitor_printf(mon, ": %s\n", stats_value->u.boolean ? "yes" : "no");
         } else if (stats_value->type == QTYPE_QLIST) {
             uint64List *list;
             int i;
index 2f8bfe8fdb4201af4bdbad47df2730308176bbd8..57db5b1c741c8e40e8b3cbae2bd294757ee3a79e 100644 (file)
 # @bytes: stat reported in bytes.
 # @seconds: stat reported in seconds.
 # @cycles: stat reported in clock cycles.
+# @boolean: stat is a boolean value.
 #
 # Since: 7.1
 ##
 { 'enum' : 'StatsUnit',
-  'data' : [ 'bytes', 'seconds', 'cycles' ] }
+  'data' : [ 'bytes', 'seconds', 'cycles', 'boolean' ] }
 
 ##
 # @StatsProvider:
 ##
 { 'alternate': 'StatsValue',
   'data': { 'scalar': 'uint64',
+            'boolean': 'bool',
             'list': [ 'uint64' ] } }
 
 ##