display_callgraph.py 479 B

12345678910111213141516171819202122
  1. #!/usr/bin/python
  2. import cPickle
  3. callgraph = cPickle.load(open("callgraph.pkl"))
  4. closure = cPickle.load(open("callgraph_closure.pkl"))
  5. sccs = cPickle.load(open("callgraph_sccs.pkl"))
  6. for n_reachable, fn in sorted(list((len(r), fn) for fn, r in closure.iteritems())):
  7. print "%s can reach %s other functions." %(fn, n_reachable)
  8. c = [ (len(component), component) for component in sccs ]
  9. c.sort()
  10. for n, component in c:
  11. if n < 2:
  12. continue
  13. print n, component