def generate_diagram_spec(stats_file): output = StringIO() parser = PstatsParser(stats_file) profile = parser.parse() dot = DotWriter(output) profile.prune(0.005, 0.001) theme = TEMPERATURE_COLORMAP theme.skew = 1.0 dot.graph(profile, theme) return output.getvalue()
def __prof2dot(self, prof_path, dot_path): """Generate dot file from pstat profile if it does not already exist""" if not os.path.isfile(dot_path): parser = PstatsParser(prof_path) profile = parser.parse() with open(dot_path, 'wt') as dotfile: dotwriter = DotWriter(dotfile) profile.prune(0.005, 0.001) dotwriter.graph(profile, TEMPERATURE_COLORMAP)
def make_dot(name): prof_name = get_prof_name(name) dot_name = get_dot_name(name) if not os.path.exists(prof_name): return False parser = PstatsParser(prof_name) profile = parser.parse() with open(dot_name, 'wt') as dotfile: dotwriter = DotWriter(dotfile) profile.prune(0.005, 0.001) dotwriter.graph(profile, TEMPERATURE_COLORMAP) return True