Prettify linkmap output

This commit is contained in:
jaseg 2020-03-13 12:59:30 +01:00
parent 9a220b6878
commit ec6e273a30

View file

@ -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: