From 45d9ea1f62e25ddfba4f284c412606c4cc4ccac3 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 24 Mar 2025 02:12:44 -0500 Subject: [PATCH] scripts: dbgmtree.py: Tightened dynamic mrid width This requires an additional traversal of the mtree just to precalculate the mrid width (mbits provides an upper-bound, but the actual number of mrids in any given mdir may be much less), but it makes the output look nicer. --- scripts/dbgmtree.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index 9dd06b36..8fcabc85 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -2324,7 +2324,10 @@ def main(disk, mroots=None, *, # dynamically size the id field w_width = max( mt.ceil(mt.log10(max(1, mtree.mbweight_())+1)), - mt.ceil(mt.log10(max(1, mtree.mrweight_())+1)), + mt.ceil(mt.log10(max(1, max( + mdir.weight for mdir in mtree.mdirs( + depth=args.get('depth')) + if isinstance(mdir, Mdir))))+1), # in case of -1.-1 2)