Skip to content

Optimizing the print format of the QEMU monitor 'info mtree'

Chao Liu qemu-devel 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest1 patch 5 repliesIn review
  2. v61 patch 4 repliesSuperseded
  3. v51 patch 1 replySuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v40 of 1 patch0 repliesSuperseded
v31 patch4 repliesSuperseded
v21 patch3 repliesSuperseded
v11 patch1 replySuperseded

Changes in v7 from the cover letter

- 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

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1system: improve visual representation of node hierarchy in 'info mtree' output for qemu monitorhmp-commands-info.hx include/system/memory.h monitor/hmp-cmds.c +1 more+143 -180 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v7 yet.

Read the v7 thread

Cover letter [PATCH v7 0/1] Optimizing the print format of the QEMU monitor 'info mtree'

From: Chao Liu <[email protected]>

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(-)
Signature · 1 line
2.48.1