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:
@@ -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" '
|
||||
|
||||
Reference in New Issue
Block a user