diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-08-10 12:11:34 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-08-10 12:11:34 -0400 |
commit | def5883bbb744727d797558da07c490f6578aff9 (patch) | |
tree | 68dcb98ca10ad64e6d0ee0e607edce454e97fdfa /scripts/maint/display_callgraph.py | |
parent | 8c92ffab226419d9a74666f5509c978b7bdf9011 (diff) | |
download | tor-def5883bbb744727d797558da07c490f6578aff9.tar.gz tor-def5883bbb744727d797558da07c490f6578aff9.zip |
Update callgraph code to find and output strongly connected components
Diffstat (limited to 'scripts/maint/display_callgraph.py')
-rwxr-xr-x | scripts/maint/display_callgraph.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/maint/display_callgraph.py b/scripts/maint/display_callgraph.py index 4e4ea637ff..9ead56c8cc 100755 --- a/scripts/maint/display_callgraph.py +++ b/scripts/maint/display_callgraph.py @@ -2,8 +2,21 @@ import cPickle -callgraph = cPickle.load(open("callgraph.cp")) -closure = cPickle.load(open("callgraph_closure.cp")) +callgraph = cPickle.load(open("callgraph.pkl")) +closure = cPickle.load(open("callgraph_closure.pkl")) +sccs = cPickle.load(open("callgraph_sccs.pkl")) for n_reachable, fn in sorted(list((len(r), fn) for fn, r in closure.iteritems())): print "%s can reach %s other functions." %(fn, n_reachable) + + +c = [ (len(component), component) for component in sccs ] +c.sort() + +for n, component in c: + if n < 2: + continue + print n, component + + + |