parseinstrs: Print stats only if not subproject

Statistics are only interesting for development.
This commit is contained in:
Alexis Engelke
2022-12-28 11:28:58 +01:00
parent 6bf96d6963
commit 36019517cf
2 changed files with 8 additions and 3 deletions

View File

@@ -77,6 +77,9 @@ endif
if get_option('with_undoc') if get_option('with_undoc')
generate_args += ['--with-undoc'] generate_args += ['--with-undoc']
endif endif
if not meson.is_subproject()
generate_args += ['--stats']
endif
tables = [] tables = []
foreach component : components foreach component : components

View File

@@ -576,7 +576,8 @@ def decode_table(entries, args):
.lower() for m in mnems] .lower() for m in mnems]
mnemonics_str = superstring(mnemonics_intel) mnemonics_str = superstring(mnemonics_intel)
print(f"Stats: Descs -- {len(descs)} ({8*len(descs)} bytes);", if args.stats:
print(f"Decode stats: Descs -- {len(descs)} ({8*len(descs)} bytes); ",
f"Trie -- {2*len(table_data)} bytes, {trie.stats}; " f"Trie -- {2*len(table_data)} bytes, {trie.stats}; "
f"Mnems -- {len(mnemonics_str)} + {3*len(mnemonics_intel)} bytes") f"Mnems -- {len(mnemonics_str)} + {3*len(mnemonics_intel)} bytes")
@@ -930,6 +931,7 @@ if __name__ == "__main__":
parser.add_argument("--32", dest="modes", action="append_const", const=32) parser.add_argument("--32", dest="modes", action="append_const", const=32)
parser.add_argument("--64", dest="modes", action="append_const", const=64) parser.add_argument("--64", dest="modes", action="append_const", const=64)
parser.add_argument("--with-undoc", action="store_true") parser.add_argument("--with-undoc", action="store_true")
parser.add_argument("--stats", action="store_true")
parser.add_argument("mode", choices=generators.keys()) parser.add_argument("mode", choices=generators.keys())
parser.add_argument("table", type=argparse.FileType('r')) parser.add_argument("table", type=argparse.FileType('r'))
parser.add_argument("out_public", type=argparse.FileType('w')) parser.add_argument("out_public", type=argparse.FileType('w'))