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.
This commit is contained in:
Christopher Haster
2025-03-24 02:12:44 -05:00
parent 582f92d073
commit 45d9ea1f62
+4 -1
View File
@@ -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)