コード例 #1
0
    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)
コード例 #2
0
def _create_profile(source, get_filename=_temp_file_from_file_field):
    """
    Parse a profile from a django file field source.
    """
    with get_filename(source) as filename:
        return PstatsParser(filename).parse()