Beispiel #1
0
 def setUp(self):
     """Provide a callgraph for a known execution profile""" 
     self._stats = pstats.Stats( self._generate_profile() )
     self._callgraph = callgraph.CallGraph( self._stats )
     
     # Index for getting the (filename, line number, name) triple by name.
     self._name_to_fln = {}
     for fln in self._stats.stats.keys():
         self._name_to_fln[ fln[2] ] = fln
Beispiel #2
0
def get_callgraph(profile_names):
    callgraph_ = callgraph.CallGraph()

    for profile_name in profile_names:
        try:
            stats = pstats.Stats(profile_name)
            callgraph_.add(stats)
        except IOError as error:
            message = "ERROR: Could not open profile file.\nReason: {0}"
            print(message.format(error), file=sys.stderr)
            sys.exit(1)

    return callgraph_