summaryrefslogtreecommitdiff
path: root/controller/fw/tools/linkmem.py
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-13 13:52:00 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-13 13:52:00 +0100
commit838eb6b26e4acc53cda47abaca6ed6392ae31ffc (patch)
tree0ba3f3cd3505d2e2d0a20a692a9e9be7b4546811 /controller/fw/tools/linkmem.py
parent43d210a1a0b9b0043685f03c86813d24e6c73cfa (diff)
downloadmaster-thesis-838eb6b26e4acc53cda47abaca6ed6392ae31ffc.tar.gz
master-thesis-838eb6b26e4acc53cda47abaca6ed6392ae31ffc.tar.bz2
master-thesis-838eb6b26e4acc53cda47abaca6ed6392ae31ffc.zip
linkmem: add subdir size contribution calculation
Diffstat (limited to 'controller/fw/tools/linkmem.py')
-rw-r--r--controller/fw/tools/linkmem.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/controller/fw/tools/linkmem.py b/controller/fw/tools/linkmem.py
index 4cfceb5..db8ddb8 100644
--- a/controller/fw/tools/linkmem.py
+++ b/controller/fw/tools/linkmem.py
@@ -169,6 +169,19 @@ if __name__ == '__main__':
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.Pastel1(i/len(subdir_colors))) for i, path in enumerate(subdir_colors) }
+ subdir_sizes = defaultdict(lambda: 0)
+ for obj, size in obj_size.items():
+ if not isinstance(size, int):
+ continue
+ if obj.startswith(subdir_prefix):
+ subdir_sizes[first_comp(obj[len(subdir_prefix):])] += size
+ else:
+ subdir_sizes['<others>'] += size
+
+ print('Subdir sizes:', file=sys.stderr)
+ for subdir, size in sorted(subdir_sizes.items(), key=lambda x: x[1]):
+ print(f'{subdir:>20}: {size:>6,d} B', file=sys.stderr)
+
def lookup_highlight(path):
if args.highlight_subdirs:
if obj.startswith(subdir_prefix):