From: Chao Liu <lc00631@tecorigin.com>
To: pbonzini@redhat.com, peterx@redhat.com, david@redhat.com,
philmd@linaro.org, armbru@redhat.com, balaton@eik.bme.hu
Cc: lc00631@tecorigin.com, chao.liu@yeah.net, qemu-devel@nongnu.org
Subject: [PATCH v7 0/1] Optimizing the print format of the QEMU monitor 'info mtree'
Date: Fri, 13 Jun 2025 15:49:28 +0800 [thread overview]
Message-ID: <cover.1749800810.git.chao.liu@yeah.net> (raw)
From: Chao Liu <chao.liu@yeah.net>
Hi, all:
After several rounds of discussion, I think that adding a -t option to the
`info mtree` command, which enables the display of tree-like node characters
(e.g., +--, |--), is a better approach.
As BALATON Zoltan pointed out, retaining space-based indentation for displaying
memory region (mr) nodes helps ensure that the output remains easily parseable
by other programs. This also provides better compatibility with existing tools
and scripts.
Users can choose between:
- Without '-t': The default format using spaces for indentation, suitable for
scripting and parsing;
- With '-t': The tree-style format using visual characters, ideal for
human-readable output.
This way, both usability and compatibility are preserved.
---
v7:
- Rebased on the top of current upstream:
d9ce74873a6a ("Merge tag 'pull-vfio-20250611' of https://github.com/legoater/qemu
into staging")
- Add -t option to 'info mtree' for tree-style node display
v6:
- Replaced the bool type with enum mtree_node_type to improve code readability;
- Modified the output to use only one horizontal dash instead of two, and
aligned character printing for a cleaner look.
v5:
- Fix one comment, level 0 no longer prints line characters.
v4:
- When printing the child nodes of a single node, the line characters from the
parent node's level are no longer printed, making the output more concise
and clear overall;
- Use more commonly used ASCII characters, such as '|--' instead of '├──',
and '`--' instead of '└──';
- Control the number of prefix characters to reduce unnecessary output.
v3:
- Use more maintainable c functions instead of macros, as per review comments.
v2:
- Enrich the commit message, add 'info mtree' print example;
- Optimize the code implementation according to the review comments.
--
Regards,
Chao
Chao Liu (1):
system: improve visual representation of node hierarchy in 'info
mtree' output for qemu monitor
hmp-commands-info.hx | 5 +-
include/system/memory.h | 3 +-
monitor/hmp-cmds.c | 3 +-
system/memory.c | 150 ++++++++++++++++++++++++++++++++++++----
4 files changed, 143 insertions(+), 18 deletions(-)
--
2.48.1
next reply other threads:[~2025-06-13 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 7:49 Chao Liu [this message]
2025-06-13 7:49 ` [PATCH v7 1/1] system: improve visual representation of node hierarchy in 'info mtree' output for qemu monitor Chao Liu
2025-06-16 5:55 ` [PATCH v7 0/1] Optimizing the print format of the QEMU monitor 'info mtree' Markus Armbruster
2025-06-16 13:45 ` Chao Liu
2025-06-16 14:44 ` Markus Armbruster
2025-06-16 15:02 ` Chao Liu
2025-06-16 16:08 ` BALATON Zoltan
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=cover.1749800810.git.chao.liu@yeah.net \
--to=lc00631@tecorigin.com \
--cc=armbru@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=chao.liu@yeah.net \
--cc=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.