scripts: dbgbmap[d3].py: Reverted percentages to entire bmap
So percentages now include unused blocks, instead of being derived from
only blocks in use.
This is a bit inconsistent with tracebd.py, where we show ops as
percentages of all ops, but it's more useful:
- mdir+btree+data gives you the total usage, which is useful if you want
to know how full disk is. You can't get this info from in-use
percentages.
Note that total field is sticking around, so you can show the total
usage directly if you provide your own title string:
$ ./scripts/dbgbmap.py disk \
--title="bd %(block_size)sx%(block_count)s, %(total_percent)s"
- You can derive the in-use percentages from total percentages if you
need them: in-use-mdir = mdir/(mdir+btree+data).
Maybe this should be added to the --title fields, but I can't think of
a good name at the moment...
Attempting to make tracebd.py consistent with dbgbmap.py doesn't really
make sense either: Showing op percentages of total bmap will usually be
an extremely small number.
At least dbgbmap.py is consistent with tracebd.py's --wear percentage,
which is out of all erase state in the bmap.
This commit is contained in:
+8
-6
@@ -4724,15 +4724,17 @@ def main_(f, disk, mroots=None, *,
|
||||
lfs.cksum,
|
||||
'' if lfs.ckgcksum() else '?'),
|
||||
'total': total_count,
|
||||
'total_percent': '%.1f%%' % (
|
||||
100*total_count / max(len(bmap), 1)),
|
||||
'mdir': mdir_count,
|
||||
'mdir_percent': '%.1f%%' % (
|
||||
100*(mdir_count / max(total_count, 1))),
|
||||
100*mdir_count / max(len(bmap), 1)),
|
||||
'btree': btree_count,
|
||||
'btree_percent': '%.1f%%' % (
|
||||
100*(btree_count / max(total_count, 1))),
|
||||
100*btree_count / max(len(bmap), 1)),
|
||||
'data': data_count,
|
||||
'data_percent': '%.1f%%' % (
|
||||
100*(data_count / max(total_count, 1))),
|
||||
100*data_count / max(len(bmap), 1)),
|
||||
}))
|
||||
elif title_littlefs:
|
||||
f.writeln('littlefs%s v%s.%s %sx%s %s w%s.%s, cksum %08x%s' % (
|
||||
@@ -4749,9 +4751,9 @@ def main_(f, disk, mroots=None, *,
|
||||
f.writeln('bd %sx%s, %6s mdir, %6s btree, %6s data' % (
|
||||
lfs.block_size if lfs.block_size is not None else '?',
|
||||
lfs.block_count if lfs.block_count is not None else '?',
|
||||
'%.1f%%' % (100*(mdir_count / max(total_count, 1))),
|
||||
'%.1f%%' % (100*(btree_count / max(total_count, 1))),
|
||||
'%.1f%%' % (100*(data_count / max(total_count, 1)))))
|
||||
'%.1f%%' % (100*mdir_count / max(len(bmap), 1)),
|
||||
'%.1f%%' % (100*btree_count / max(len(bmap), 1)),
|
||||
'%.1f%%' % (100*data_count / max(len(bmap), 1))))
|
||||
|
||||
# draw canvas
|
||||
for row in range(canvas.height//canvas.yscale):
|
||||
|
||||
@@ -5007,15 +5007,17 @@ def main(disk, output, mroots=None, *,
|
||||
lfs.cksum,
|
||||
'' if lfs.ckgcksum() else '?'),
|
||||
'total': total_count,
|
||||
'total_percent': '%.1f%%' % (
|
||||
100*total_count / max(len(bmap), 1)),
|
||||
'mdir': mdir_count,
|
||||
'mdir_percent': '%.1f%%' % (
|
||||
100*(mdir_count / max(total_count, 1))),
|
||||
100*mdir_count / max(len(bmap), 1)),
|
||||
'btree': btree_count,
|
||||
'btree_percent': '%.1f%%' % (
|
||||
100*(btree_count / max(total_count, 1))),
|
||||
100*btree_count / max(len(bmap), 1)),
|
||||
'data': data_count,
|
||||
'data_percent': '%.1f%%' % (
|
||||
100*(data_count / max(total_count, 1))),
|
||||
100*data_count / max(len(bmap), 1)),
|
||||
}))
|
||||
elif not title_usage:
|
||||
f.write('littlefs%s v%s.%s %sx%s %s w%s.%s, cksum %08x%s' % (
|
||||
@@ -5032,9 +5034,9 @@ def main(disk, output, mroots=None, *,
|
||||
f.writeln('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 '?',
|
||||
'%.1f%%' % (100*(mdir_count / max(total_count, 1))),
|
||||
'%.1f%%' % (100*(btree_count / max(total_count, 1))),
|
||||
'%.1f%%' % (100*(data_count / max(total_count, 1)))))
|
||||
'%.1f%%' % (100*mdir_count / max(len(bmap), 1)),
|
||||
'%.1f%%' % (100*btree_count / max(len(bmap), 1)),
|
||||
'%.1f%%' % (100*data_count / max(len(bmap), 1))))
|
||||
f.write('</tspan>')
|
||||
if not no_mode and not no_javascript:
|
||||
f.write('<tspan id="mode" x="%(x)d" y="1.1em" '
|
||||
|
||||
+15
-19
@@ -46,7 +46,7 @@ COLORS = {
|
||||
# assign chars/colors to varying levels of wear
|
||||
WEAR_CHARS = '0123456789'
|
||||
# TODO adopt 9x for all of these?
|
||||
WEAR_COLORS = ['36', '36', '36', '', '', '', '', '31', '31', '91']
|
||||
WEAR_COLORS = ['90', '90', '90', '', '', '', '', '31', '31', '91']
|
||||
|
||||
# give more interesting operations a higher priority
|
||||
#
|
||||
@@ -1900,8 +1900,12 @@ def main(path='-', *,
|
||||
if b.wear == 0:
|
||||
continue
|
||||
ranges__ = RangeSet([range(block_size_)])
|
||||
# scale char/color based on max_wear/block_cycles
|
||||
wear__ = b.wear / max(block_cycles_, 1)
|
||||
# scale char/color based on either block_cycles
|
||||
# or wear_avg
|
||||
if block_cycles is not None:
|
||||
wear__ = min(b.wear / max(block_cycles, 1), 1.0)
|
||||
else:
|
||||
wear__ = min(b.wear / max(2*wear_avg, 1), 1.0)
|
||||
char__ = b.wear_chars[int(wear__*(len(b.wear_chars)-1))]
|
||||
color__ = b.wear_colors[int(wear__*(len(b.wear_colors)-1))]
|
||||
else:
|
||||
@@ -1995,23 +1999,18 @@ def main(path='-', *,
|
||||
'erase': erased,
|
||||
'erase_percent': 100*erased / max(total, 1),
|
||||
'wear_min': wear_min if wear else '?',
|
||||
'wear_min_percent': 100*wear_min / max(wear_max, 1)
|
||||
'wear_min_percent': 100*wear_min / max(block_cycles_, 1)
|
||||
if wear else '?',
|
||||
# 'wear_min_stddev': (wear_min-wear_avg) / max(wear_stddev, 1)
|
||||
# if wear else '?',
|
||||
'wear_max': wear_max if wear else '?',
|
||||
'wear_max_percent': 100*wear_max / max(wear_max, 1)
|
||||
'wear_max_percent': 100*wear_max / max(block_cycles_, 1)
|
||||
if wear else '?',
|
||||
# 'wear_max_stddev': (wear_max-wear_avg) / max(wear_stddev, 1)
|
||||
# if wear else '?',
|
||||
'wear_avg': wear_avg if wear else '?',
|
||||
'wear_avg_percent': 100*wear_avg / max(wear_max, 1)
|
||||
'wear_avg_percent': 100*wear_avg / max(block_cycles_, 1)
|
||||
if wear else '?',
|
||||
'wear_stddev': wear_stddev if wear else '?',
|
||||
'wear_stddev_percent': 100*wear_stddev / max(wear_max, 1)
|
||||
if wear else '?',
|
||||
# 'wear_stddev_percent': 100*(wear_stddev) / max(wear_max, 1)
|
||||
# if wear else '?',
|
||||
'wear_stddev_percent':
|
||||
100*wear_stddev / max(block_cycles_, 1)
|
||||
if wear else '?',
|
||||
}))
|
||||
else:
|
||||
# ring.writeln('curve: %s' % (curve.cache_info(),))
|
||||
@@ -2028,8 +2027,8 @@ def main(path='-', *,
|
||||
if erases else '',
|
||||
', %15s wear' % (
|
||||
'%.1f%% +-%.1fσ' % (
|
||||
100*wear_avg / max(wear_max, 1),
|
||||
100*wear_stddev / max(wear_max, 1)))
|
||||
100*wear_avg / max(block_cycles_, 1),
|
||||
100*wear_stddev / max(block_cycles_, 1)))
|
||||
if wear else ''))
|
||||
|
||||
# draw canvas
|
||||
@@ -2606,12 +2605,9 @@ if __name__ == "__main__":
|
||||
'--wear-only',
|
||||
action='store_true',
|
||||
help="Only render wear, don't render bd ops. Implies --wear.")
|
||||
# TODO implies --wear?
|
||||
parser.add_argument(
|
||||
'-w', '--block-cycles',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=0,
|
||||
help="Assumed maximum number of erase cycles when measuring "
|
||||
"wear. Implies --wear.")
|
||||
parser.add_argument(
|
||||
|
||||
Reference in New Issue
Block a user