From a5e59b21904be4ebf6be7d05e192b721a1f49d03 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 11 Apr 2025 19:28:03 -0500 Subject: [PATCH] scripts: maps: Reverted all padding for status strings After all, who doesn't love a good bit of flickering. I think I was trying to be too clever, so reverting. Printing these with no padding is the simplest solution, provides the best information density, and worst case you can always add -s1 to limit the update frequency if flickering is hurting readability. --- scripts/dbgbmap.py | 22 ++++------------------ scripts/dbgtrace.py | 35 +++++++---------------------------- 2 files changed, 11 insertions(+), 46 deletions(-) diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index 08312d33..2a5a6047 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -4588,26 +4588,12 @@ def main_(ring, disk, mroots=None, *, lfs.cksum, '' if lfs.ckgcksum() else '?')) else: - # hack time~, to avoid flickering, keep track of worst padding - # globally - mdir_percent = '%.1f%%' % (100*mdir_count / max(len(bmap), 1)) - btree_percent = '%.1f%%' % (100*btree_count / max(len(bmap), 1)) - data_percent = '%.1f%%' % (100*data_count / max(len(bmap), 1)) - main_.mdir_padding = max( - getattr(main_, 'mdir_padding', 0), - len(mdir_percent)) - main_.btree_padding = max( - getattr(main_, 'btree_padding', 0), - len(btree_percent)) - main_.data_padding = max( - getattr(main_, 'data_padding', 0), - len(data_percent)) - title_ = ('bd %sx%s, %.*s mdir, %.*s btree, %.*s data' % ( + title_ = ('bd %sx%s, %s mdir, %s btree, %s data' % ( lfs.block_size if lfs.block_size is not None else '?', lfs.block_count if lfs.block_count is not None else '?', - main_.mdir_padding, mdir_percent, - main_.btree_padding, btree_percent, - main_.data_padding, data_percent)) + '%.1f%%' % (100*mdir_count / max(len(bmap), 1)), + '%.1f%%' % (100*btree_count / max(len(bmap), 1)), + '%.1f%%' % (100*data_count / max(len(bmap), 1)))) # scale width/height if requested if (to_scale is not None diff --git a/scripts/dbgtrace.py b/scripts/dbgtrace.py index c3f9e2c6..f4f1c387 100755 --- a/scripts/dbgtrace.py +++ b/scripts/dbgtrace.py @@ -1244,39 +1244,18 @@ def main(path='-', *, 100*wear_stddev / max(block_cycles_, 1) if wear else '?', }) else: - # hack time~, to avoid flickering, keep track of worst padding - # globally - if reads: - read_percent = '%.1f%%' % (100*readed / max(total, 1)) - draw__.read_padding = max( - getattr(draw__, 'read_padding', 0), - len(read_percent)) - if progs: - prog_percent = '%.1f%%' % (100*proged / max(total, 1)) - draw__.prog_padding = max( - getattr(draw__, 'prog_padding', 0), - len(prog_percent)) - if erases: - erase_percent = '%.1f%%' % (100*erased / max(total, 1)) - draw__.erase_padding = max( - getattr(draw__, 'erase_padding', 0), - len(erase_percent)) - if wear: - wear_percent = '%.1f%% +-%.1fσ' % ( - 100*wear_avg / max(block_cycles_, 1), - 100*wear_stddev / max(block_cycles_, 1)) - draw__.wear_padding = max( - getattr(draw__, 'wear_padding', 0), - len(wear_percent)) title_ = ('bd %dx%d%s%s%s%s' % ( block_size_, block_count_, - ', %*s read' % (draw__.read_padding, read_percent) + ', %s read' % ('%.1f%%' % (100*readed / max(total, 1))) if reads else '', - ', %*s prog' % (draw__.prog_padding, prog_percent) + ', %s prog' % ('%.1f%%' % (100*proged / max(total, 1))) if progs else '', - ', %*s erase' % (draw__.erase_padding, erase_percent) + ', %s erase' % ('%.1f%%' % (100*erased / max(total, 1))) if erases else '', - ', %*s wear' % (draw__.wear_padding, wear_percent) + ', %s wear' % ( + '%.1f%% +-%.1fσ' % ( + 100*wear_avg / max(block_cycles_, 1), + 100*wear_stddev / max(block_cycles_, 1))) if wear else '')) # give ring a writeln function