From ec6e273a30574e61f2b83cc351f7979229ff283b Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 13 Mar 2020 12:59:30 +0100 Subject: Prettify linkmap output --- controller/fw/tools/linkmem.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/controller/fw/tools/linkmem.py b/controller/fw/tools/linkmem.py index 3d08d19..164c7cf 100644 --- a/controller/fw/tools/linkmem.py +++ b/controller/fw/tools/linkmem.py @@ -146,11 +146,12 @@ if __name__ == '__main__': clusters = defaultdict(lambda: []) for sym, (obj, size) in syms.items(): - clusters[obj].append((sym, size)) + if sym in syms_out: + clusters[obj].append((sym, size)) obj_size = defaultdict(lambda: 0) - for name, (obj, size) in syms.items(): - if size is not None: + for sym, (obj, size) in syms.items(): + if size is not None and sym in syms_out: obj_size[obj] += size max_size = max([ size for _obj, size in syms.values() if size is not None ]) @@ -159,7 +160,7 @@ if __name__ == '__main__': subdir_prefix = path.abspath(args.highlight_subdirs) + '/' if args.highlight_subdirs else '### NO HIGHLIGHT ###' first_comp = lambda le_path: path.dirname(le_path).partition(os.sep)[0] subdir_colors = sorted({ first_comp(obj[len(subdir_prefix):]) for obj in obj_size if obj.startswith(subdir_prefix) }) - subdir_colors = { path: hexcolor(*matplotlib.cm.Paired(i/len(subdir_colors))) for i, path in enumerate(subdir_colors) } + subdir_colors = { path: hexcolor(*matplotlib.cm.Pastel1(i/len(subdir_colors))) for i, path in enumerate(subdir_colors) } def lookup_highlight(path): if args.highlight_subdirs: -- cgit