From 0f93f269d4deb8df7d11482dcc18a9bc590561b6 Mon Sep 17 00:00:00 2001 From: rozlette Date: Mon, 20 Jan 2020 23:19:19 -0600 Subject: [PATCH] Add ability in progress.py to print out an individual file's progress --- tools/progress.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tools/progress.py b/tools/progress.py index f8ba5c61e9..22a803048e 100644 --- a/tools/progress.py +++ b/tools/progress.py @@ -13,6 +13,11 @@ def read_all_lines(file_name): return lines if __name__ == "__main__": + parser = argparse.ArgumentParser() + + parser.add_argument('--file', help='File to print progress off. If excluded, defaults to all files.') + args = parser.parse_args() + map_lines = read_all_lines('build/mm.map') current_section = '' @@ -63,10 +68,16 @@ if __name__ == "__main__": src = 0 asm = 0 - for section in src_amounts: - src += src_amounts[section] - for section in asm_amounts: - asm += asm_amounts[section] + if args.file == None: + for section in src_amounts: + src += src_amounts[section] + for section in asm_amounts: + asm += asm_amounts[section] + else: + if args.file not in src_amounts or args.file not in asm_amounts: + sys.exit('{} not found in map file'.format(args.file)) + src += src_amounts[args.file] + asm += asm_amounts[args.file] total = src + asm src_percent = 100 * src / total