diff options
author | Zachary Turner <zturner@google.com> | 2017-03-22 18:23:14 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-22 18:23:14 +0000 |
commit | bbd17224d856e81cec5e1874925d0fccffaac071 (patch) | |
tree | 777c6d18b760e5d10bed54cc757a0e0356a34b9e | |
parent | f7691d8b410dc4ccb4eacb4bf9151f3ee91fd7fe (diff) | |
download | bcm5719-llvm-bbd17224d856e81cec5e1874925d0fccffaac071.tar.gz bcm5719-llvm-bbd17224d856e81cec5e1874925d0fccffaac071.zip |
[analyze deps] Show incoming and outgoing counts on island members.
llvm-svn: 298535
-rw-r--r-- | lldb/scripts/analyze-project-deps.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lldb/scripts/analyze-project-deps.py b/lldb/scripts/analyze-project-deps.py index 42c398b1123..e06d7035d43 100644 --- a/lldb/scripts/analyze-project-deps.py +++ b/lldb/scripts/analyze-project-deps.py @@ -3,6 +3,7 @@ import itertools import os import re import sys +from collections import defaultdict from use_lldb_suite import lldb_root @@ -165,8 +166,8 @@ if args.discover_cycles: average = sum([len(x)+1 for x in cycles]) / len(cycles) print "Found {} cycles. Average cycle length = {}.".format(len(cycles), average) + counted = list(iter_cycles(cycles)) if args.show_counts: - counted = list(iter_cycles(cycles)) counted.sort(lambda A, B: cmp(A[0], B[0])) for (total, smallest, cycle) in counted: sys.stdout.write("{} deps to break: ".format(total)) @@ -181,6 +182,12 @@ if args.discover_cycles: print "Analyzing islands..." islands = [] + outgoing_counts = defaultdict(int) + incoming_counts = defaultdict(int) + for (total, smallest, cycle) in counted: + for (first, count, last) in cycle: + outgoing_counts[first] += count + incoming_counts[last] += count for cycle in cycles: this_cycle = set(cycle) disjoints = [x for x in islands if this_cycle.isdisjoint(x)] @@ -189,7 +196,11 @@ if args.discover_cycles: print "Found {} disjoint cycle islands...".format(len(islands)) for island in islands: print "Island ({} elements)".format(len(island)) + sorted = [] for node in island: - print " {0}".format(node) + sorted.append((node, incoming_counts[node], outgoing_counts[node])) + sorted.sort(lambda x, y: cmp(x[1]+x[2], y[1]+y[2])) + for (node, inc, outg) in sorted: + print " {} [{} in, {} out]".format(node, inc, outg) sys.stdout.flush() pass
\ No newline at end of file |