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:
+4
-1
@@ -2324,7 +2324,10 @@ def main(disk, mroots=None, *,
|
|||||||
# dynamically size the id field
|
# dynamically size the id field
|
||||||
w_width = max(
|
w_width = max(
|
||||||
mt.ceil(mt.log10(max(1, mtree.mbweight_())+1)),
|
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
|
# in case of -1.-1
|
||||||
2)
|
2)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user