QEMU-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, hreitz@redhat.com, qemu-devel@nongnu.org
Subject: [PATCH] block: Improve readability in HMP 'info blockstats' output
Date: Tue, 12 May 2026 13:27:59 +0200	[thread overview]
Message-ID: <20260512112759.66038-1-kwolf@redhat.com> (raw)

Instead of a long line with key=value pairs for each block device,
switch to a tabular form with aligned values. This makes it much easier
to find the relevant information in the output.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/monitor/block-hmp-cmds.c | 38 ++++++++++++++++------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
index 1fd28d59eb1..69ade0534f1 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -794,30 +794,28 @@ void hmp_info_blockstats(Monitor *mon, const QDict *qdict)
             continue;
         }
 
-        monitor_printf(mon, "%s:", stats->value->device);
-        monitor_printf(mon, " rd_bytes=%" PRId64
-                       " wr_bytes=%" PRId64
-                       " rd_operations=%" PRId64
-                       " wr_operations=%" PRId64
-                       " flush_operations=%" PRId64
-                       " wr_total_time_ns=%" PRId64
-                       " rd_total_time_ns=%" PRId64
-                       " flush_total_time_ns=%" PRId64
-                       " rd_merged=%" PRId64
-                       " wr_merged=%" PRId64
-                       " idle_time_ns=%" PRId64
-                       "\n",
+        monitor_printf(mon, "%s%s: idle_time_ns=%" PRId64 "\n",
+                       stats != stats_list ? "\n" : "",
+                       stats->value->device,
+                       stats->value->stats->idle_time_ns);
+        monitor_printf(mon, "       %24s %16s %24s %10s\n", "bytes",
+                       "operations", "total_time_ns", "merged");
+        monitor_printf(mon, "Read:  %24" PRId64 " %16" PRId64 " %24" PRId64
+                       " %10" PRId64 "\n",
                        stats->value->stats->rd_bytes,
-                       stats->value->stats->wr_bytes,
                        stats->value->stats->rd_operations,
+                       stats->value->stats->rd_total_time_ns,
+                       stats->value->stats->rd_merged);
+        monitor_printf(mon, "Write: %24" PRId64 " %16" PRId64 " %24" PRId64
+                       " %10" PRId64 "\n",
+                       stats->value->stats->wr_bytes,
                        stats->value->stats->wr_operations,
-                       stats->value->stats->flush_operations,
                        stats->value->stats->wr_total_time_ns,
-                       stats->value->stats->rd_total_time_ns,
-                       stats->value->stats->flush_total_time_ns,
-                       stats->value->stats->rd_merged,
-                       stats->value->stats->wr_merged,
-                       stats->value->stats->idle_time_ns);
+                       stats->value->stats->wr_merged);
+        monitor_printf(mon, "Flush: %24s %16" PRId64 " %24" PRId64 "\n",
+                       "",
+                       stats->value->stats->flush_operations,
+                       stats->value->stats->flush_total_time_ns);
     }
 
     qapi_free_BlockStatsList(stats_list);
-- 
2.54.0



                 reply	other threads:[~2026-05-12 11:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260512112759.66038-1-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox